submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s697435518 | p03666 | C++ | #include <bits/stdc++.h>
#define ll long long;
int main(){
ll n, a, b, l, r;
cin>>n>>a>>b>>l>>r;
int flag = 1;
ll x, y;
for(ll i = 0; i <= n-1;i++){
x = a+l*i-(n-i-1)*r;
y = a+r*i-(n-i-1)*l;
if(x <= b && b <= y){
flag = 0;
}
}
printf("%s\n", flag?"NO":"YES");
return 0;
} | a.cc: In function 'int main()':
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
3 | #define ll long long;
| ^~~~
a.cc:6:5: note: in expansion of macro 'll'
6 | ll n, a, b, l, r;
| ^~
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
6 | ll n, a, b, l, r;
| ^
| yn
a.cc:6:11: error: 'a' was not declared in this scope
6 | ll n, a, b, l, r;
| ^
a.cc:6:14: error: 'b' was not declared in this scope
6 | ll n, a, b, l, r;
| ^
a.cc:6:17: error: 'l' was not declared in this scope; did you mean 'll'?
6 | ll n, a, b, l, r;
| ^
| ll
a.cc:6:20: error: 'r' was not declared in this scope
6 | ll n, a, b, l, r;
| ^
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin>>n>>a>>b>>l>>r;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
3 | #define ll long long;
| ^~~~
a.cc:9:5: note: in expansion of macro 'll'
9 | ll x, y;
| ^~
a.cc:9:8: error: 'x' was not declared in this scope
9 | ll x, y;
| ^
a.cc:9:11: error: 'y' was not declared in this scope; did you mean 'yn'?
9 | ll x, y;
| ^
| yn
a.cc:3:17: error: declaration does not declare anything [-fpermissive]
3 | #define ll long long;
| ^~~~
a.cc:10:9: note: in expansion of macro 'll'
10 | for(ll i = 0; i <= n-1;i++){
| ^~
a.cc:10:12: error: 'i' was not declared in this scope
10 | for(ll i = 0; i <= n-1;i++){
| ^
a.cc:10:27: error: expected ')' before ';' token
10 | for(ll i = 0; i <= n-1;i++){
| ~ ^
| )
a.cc:10:28: error: 'i' was not declared in this scope
10 | for(ll i = 0; i <= n-1;i++){
| ^
|
s664116161 | p03666 | C++ | //#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
//assert(q==w) если q!=w --> runtime error
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define ub upper_bound
#define lb lower_bound
#define bit __builtin_popcount
#define memset(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vector<int>> matrix;
inline void boost(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
const ll maxn=2e5+123;
const ll inf=1e9+123;
const ll linf=1e18+123;
const ll mod=1e9+7;
const double eps=1e-9;
const double pi=acos(-1);
int dx[8]={0,1,-1,0,1,-1,1,-1};
int dy[8]={1,0,0,-1,1,1,-1,-1};
int main(){
boost();
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ll n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
for(int i=1;i<=n-1;i++){
ll l=a+(c*i);
ll r=a+(d*i);
ll l2=b+(n-i-1)*c;
ll r2=b+(n-i-1)*d;
if(){
cout<<"YES";
return 0;
}
}
cout<<"NO";
exit(0);
}
| a.cc: In function 'int main()':
a.cc:51:12: error: expected primary-expression before ')' token
51 | if(){
| ^
|
s685791706 | p03666 | C++ | #include <iostream>
using namespace std;
int main(){
long long N, A, B, C, D;
cin >> N >> A >> B >> C >> D;
// 深さN-1のノードに対して判定処理を行う。
for(long long i = 0; i < N; ++i){
// lower_bound
long long lb = A + i * C + (i - (n - 1)) * D;
// upper_bound
long long ub = A + (i - (n - 1)) * C + i * D;
if(lb <= B && B <= ub){
cout << "YES\n";
return 0;
}
}
cout << "NO\n";
} | a.cc: In function 'int main()':
a.cc:10:42: error: 'n' was not declared in this scope
10 | long long lb = A + i * C + (i - (n - 1)) * D;
| ^
|
s137717581 | p03666 | C++ | #include <iostream>
using namespace std;
int main(){
long long N, A, B, C, D;
cin >> N >> A >> B >> C >> D;
// 深さN-1のノードに対して判定処理を行う。
for(long long i = 0; i < N; ++i){
// lower_bound
long long lb = A + i * C + (i - (n - 1)) * D;
// upper_bound
long long ub = a + (i - (n - 1)) * C + i * D;
if(lb <= B && B <= ub){
cout << "YES\n";
return 0;
}
}
cout << "NO\n";
} | a.cc: In function 'int main()':
a.cc:10:42: error: 'n' was not declared in this scope
10 | long long lb = A + i * C + (i - (n - 1)) * D;
| ^
a.cc:12:24: error: 'a' was not declared in this scope
12 | long long ub = a + (i - (n - 1)) * C + i * D;
| ^
|
s365316676 | p03666 | C++ | \#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);
ll n,a,b,c,d;
signed main(){
cin>>n>>a>>b>>c>>d;
n--;
if(b<a)swap(a,b);
b-=a;
if(!c && !d){
if(b==0)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
if(c==d){
if(b%c==0)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}
if((n)*(d-c)>=c+d){
cout<<"YES"<<endl;
}else{
for(int i=0;i <= n;i++)
{
if(c*n-i*(c+d) <= b && b <= d*n-i*(c+d)){
cout<<"YES"<<endl;
return 0;
}
}
cout<<"NO"<<endl;
}
}
| a.cc:1:1: error: stray '\' in program
1 | \#include <bits/stdc++.h>
| ^
a.cc:1:2: error: stray '#' in program
1 | \#include <bits/stdc++.h>
| ^
a.cc:1:3: error: 'include' does not name a type
1 | \#include <bits/stdc++.h>
| ^~~~~~~
a.cc:12:9: error: 'pair' does not name a type
12 | typedef pair<int,int> P;
| ^~~~
a.cc:13:9: error: 'pair' does not name a type
13 | typedef pair<ll,ll> PL;
| ^~~~
a.cc: In function 'int main()':
a.cc:21:5: error: 'cin' was not declared in this scope
21 | cin>>n>>a>>b>>c>>d;
| ^~~
a.cc:23:12: error: 'swap' was not declared in this scope
23 | if(b<a)swap(a,b);
| ^~~~
a.cc:28:15: error: 'cout' was not declared in this scope
28 | if(b==0)cout<<"YES"<<endl;
| ^~~~
a.cc:28:28: error: 'endl' was not declared in this scope
28 | if(b==0)cout<<"YES"<<endl;
| ^~~~
a.cc:29:12: error: 'cout' was not declared in this scope
29 | else cout<<"NO"<<endl;
| ^~~~
a.cc:29:24: error: 'endl' was not declared in this scope
29 | else cout<<"NO"<<endl;
| ^~~~
a.cc:34:17: error: 'cout' was not declared in this scope
34 | if(b%c==0)cout<<"YES"<<endl;
| ^~~~
a.cc:34:30: error: 'endl' was not declared in this scope
34 | if(b%c==0)cout<<"YES"<<endl;
| ^~~~
a.cc:35:12: error: 'cout' was not declared in this scope
35 | else cout<<"NO"<<endl;
| ^~~~
a.cc:35:24: error: 'endl' was not declared in this scope
35 | else cout<<"NO"<<endl;
| ^~~~
a.cc:40:7: error: 'cout' was not declared in this scope
40 | cout<<"YES"<<endl;
| ^~~~
a.cc:40:20: error: 'endl' was not declared in this scope
40 | cout<<"YES"<<endl;
| ^~~~
a.cc:45:10: error: 'cout' was not declared in this scope
45 | cout<<"YES"<<endl;
| ^~~~
a.cc:45:23: error: 'endl' was not declared in this scope
45 | cout<<"YES"<<endl;
| ^~~~
a.cc:49:6: error: 'cout' was not declared in this scope
49 | cout<<"NO"<<endl;
| ^~~~
a.cc:49:18: error: 'endl' was not declared in this scope
49 | cout<<"NO"<<endl;
| ^~~~
|
s194316216 | p03666 | C++ | tr();
}
const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
signed main(int argc, char const *argv[])
{
cin.tie(0);
ios::sync_with_stdio(false);
LL N,A,B,C,D; cin >> N >> A>>B>>C>>D;
N--;
LL dif = abs(A-B);
bool ok = 0;
for(LL i = 0; i <= N/2; i++){
LL s = C*(N-2LL*i);
LL l = (D-C)*i + D * (N-2LL*i);
if(s <= dif && dif <= l) ok = 1;
}
if(ok) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc:1:5: error: expected constructor, destructor, or type conversion before ';' token
1 | tr();
| ^
a.cc:2:1: error: expected declaration before '}' token
2 | }
| ^
a.cc:5:7: error: 'LL' does not name a type
5 | const LL LINF = 1001002003004005006ll;
| ^~
a.cc: In function 'int main(int, const char**)':
a.cc:10:5: error: 'cin' was not declared in this scope
10 | cin.tie(0);
| ^~~
a.cc:11:5: error: 'ios' has not been declared
11 | ios::sync_with_stdio(false);
| ^~~
a.cc:12:5: error: 'LL' was not declared in this scope
12 | LL N,A,B,C,D; cin >> N >> A>>B>>C>>D;
| ^~
a.cc:12:26: error: 'N' was not declared in this scope
12 | LL N,A,B,C,D; cin >> N >> A>>B>>C>>D;
| ^
a.cc:12:31: error: 'A' was not declared in this scope
12 | LL N,A,B,C,D; cin >> N >> A>>B>>C>>D;
| ^
a.cc:12:34: error: 'B' was not declared in this scope
12 | LL N,A,B,C,D; cin >> N >> A>>B>>C>>D;
| ^
a.cc:12:37: error: 'C' was not declared in this scope
12 | LL N,A,B,C,D; cin >> N >> A>>B>>C>>D;
| ^
a.cc:12:40: error: 'D' was not declared in this scope
12 | LL N,A,B,C,D; cin >> N >> A>>B>>C>>D;
| ^
a.cc:14:7: error: expected ';' before 'dif'
14 | LL dif = abs(A-B);
| ^~~~
| ;
a.cc:16:11: error: expected ';' before 'i'
16 | for(LL i = 0; i <= N/2; i++){
| ^~
| ;
a.cc:16:19: error: 'i' was not declared in this scope
16 | for(LL i = 0; i <= N/2; i++){
| ^
a.cc:17:11: error: expected ';' before 's'
17 | LL s = C*(N-2LL*i);
| ^~
| ;
a.cc:18:11: error: expected ';' before 'l'
18 | LL l = (D-C)*i + D * (N-2LL*i);
| ^~
| ;
a.cc:19:12: error: 's' was not declared in this scope
19 | if(s <= dif && dif <= l) ok = 1;
| ^
a.cc:19:17: error: 'dif' was not declared in this scope
19 | if(s <= dif && dif <= l) ok = 1;
| ^~~
a.cc:19:31: error: 'l' was not declared in this scope
19 | if(s <= dif && dif <= l) ok = 1;
| ^
a.cc:21:12: error: 'cout' was not declared in this scope
21 | if(ok) cout << "YES" << endl;
| ^~~~
a.cc:21:29: error: 'endl' was not declared in this scope
21 | if(ok) cout << "YES" << endl;
| ^~~~
a.cc:22:10: error: 'cout' was not declared in this scope
22 | else cout << "NO" << endl;
| ^~~~
a.cc:22:26: error: 'endl' was not declared in this scope
22 | else cout << "NO" << endl;
| ^~~~
|
s801403910 | p03666 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
bool flg=false;
for(int m=0;m<n;m++){
if(m*c+(n-1-m)*d<=b-a && b-a<=d*m-(n-1-m)*c)flg=true;
cout<<(flg?"YES":"NO")<<endl;
} | a.cc: In function 'int main()':
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:5:14: note: to match this '{'
5 | signed main(){
| ^
|
s566277228 | p03666 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM + 7
#define MAX 10100000
#define INF 1e15
#define MAP 110
#define initial_value -1
#define LINF 1LL << 60
#define Pair pair<int, int>
#define chmax(a, b) (a < b ? a = b : 0)
#define chmin(a, b) (a > b ? a = b : 0)
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
ll N,A,B,C,D;
int main(){
cin >> N >> A >> B >> C >> D;
bool ans = false;
for(ll i = 0; i < N; i++){
ll ma = i*D - (N-i-1)*C;
ll mi = i*C - (N-1-i)*D;
if(mi <= diff && diff <= ma) ans = true;
}
if(ans) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:24:18: error: 'diff' was not declared in this scope
24 | if(mi <= diff && diff <= ma) ans = true;
| ^~~~
|
s939879516 | p03666 | C++ | #include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
typedef long long LL;
int main()
{
LL n, a, b, c, d;
scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
for (register int i = 0; i < n; i++)
{
LL maxv = a + i*d - (n-i-1)*c;
LL minv = a + i*c - (n-i-1)*d;
if (minv <= b && b <= maxv) printf("YES"), return 0;
}
printf("NO");
return 0;
} | a.cc: In function 'int main()':
a.cc:12:27: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
12 | for (register int i = 0; i < n; i++)
| ^
a.cc:16:60: error: expected primary-expression before 'return'
16 | if (minv <= b && b <= maxv) printf("YES"), return 0;
| ^~~~~~
|
s338652744 | p03666 | C++ | #include <bits/stdc++.h>
using namespace std;
//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//container util
#define all(x) (x).begin(),(x).end()
//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
int main(){
int N,A,B,C,D;
cin >> N >> A >> B >> C >> D;
rep(i,n+1){
if(B >= c * i - D * (N-i) && B <= D * i - C * (N-i) ){
cout << "YES" << endl;
return 0;
}
}
cout << "NO" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:31:9: error: 'n' was not declared in this scope
31 | rep(i,n+1){
| ^
a.cc:6:44: note: in definition of macro 'rep'
6 | #define rep(i, n) for(int i = 0; i < (int)(n); i++)
| ^
a.cc:32:13: error: 'c' was not declared in this scope
32 | if(B >= c * i - D * (N-i) && B <= D * i - C * (N-i) ){
| ^
|
s287215660 | p03666 | C++ | /**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;
typedef long long ll;
long long readInt() {
bool minus1 = false;
long long result = 0;
char ch;
ch = getchar();
while (true) {
if (ch == '-') break;
if (ch >= '0' && ch <= '9') break;
ch = getchar();
}
if (ch == '-') minus1 = true; else result = ch-'0';
while (true) {
ch = getchar();
if (ch < '0' || ch > '9') break;
result = result*10 + (ch - '0');
}
if (minus1)
return -result;
else
return result;
}
int go(int x) {
return (x * (x + 1)) / 2;
}
main() {
#ifdef IZI_KATKA
assert(freopen("input", "r", stdin));
assert(freopen("output", "w", stdout));
#endif
int n = readInt(), A = readInt(), B = readInt(), C = readInt(), D = readInt();
///A + 2 * A + 3 * A + 4 * A .... = A (1 + 2 + 3 ...)
n -= 2;
for (int i = 0; i <= n; i++) {
int kol1 = A + C * go(i);
int kol2 = B + C * go(n - i);
int diff = (kol1 - kol2);
if (diff > 0) {
if (i == 0) continue;
int k = (diff + i - 1) / i;
if (k <= D - C && k != i) {
cout << "YES";
return 0;
}
} else if (diff < 0) {
if (i == n) continue;
diff = abs(diff);
int k = (diff + n - i + 1) / (n - i);
if (k <= D - C && k != n - i) {
cout << "YES";
}
} else {
cout << "YES";
return 0;
}
}
cout << "NO";
return 0;
} | a.cc:36:13: error: '__int64' does not name a type; did you mean '__int64_t'?
36 | #define int __int64
| ^~~~~~~
a.cc:67:1: note: in expansion of macro 'int'
67 | int go(int x) {
| ^~~
a.cc:71:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
71 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:36:13: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
36 | #define int __int64
| ^~~~~~~
a.cc:76:5: note: in expansion of macro 'int'
76 | int n = readInt(), A = readInt(), B = readInt(), C = readInt(), D = readInt();
| ^~~
a.cc:78:5: error: 'n' was not declared in this scope; did you mean 'yn'?
78 | n -= 2;
| ^
| yn
a.cc:79:14: error: expected ';' before 'i'
79 | for (int i = 0; i <= n; i++) {
| ^
a.cc:79:21: error: 'i' was not declared in this scope
79 | for (int i = 0; i <= n; i++) {
| ^
a.cc:80:21: error: expected ';' before 'kol1'
80 | int kol1 = A + C * go(i);
| ^~~~
a.cc:81:21: error: expected ';' before 'kol2'
81 | int kol2 = B + C * go(n - i);
| ^~~~
a.cc:82:21: error: expected ';' before 'diff'
82 | int diff = (kol1 - kol2);
| ^~~~
a.cc:83:21: error: 'diff' was not declared in this scope
83 | if (diff > 0) {
| ^~~~
a.cc:85:25: error: expected ';' before 'k'
85 | int k = (diff + i - 1) / i;
| ^
a.cc:86:25: error: 'k' was not declared in this scope
86 | if (k <= D - C && k != i) {
| ^
a.cc:86:30: error: 'D' was not declared in this scope
86 | if (k <= D - C && k != i) {
| ^
a.cc:86:34: error: 'C' was not declared in this scope
86 | if (k <= D - C && k != i) {
| ^
a.cc:93:29: error: expected ';' before 'k'
93 | int k = (diff + n - i + 1) / (n - i);
| ^
a.cc:94:29: error: 'k' was not declared in this scope
94 | if (k <= D - C && k != n - i) {
| ^
a.cc:94:34: error: 'D' was not declared in this scope
94 | if (k <= D - C && k != n - i) {
| ^
a.cc:94:38: error: 'C' was not declared in this scope
94 | if (k <= D - C && k != n - i) {
| ^
|
s474742436 | p03666 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;
template<typename T>
void printv(vector<T> const& s) {
REP(i, SZ(s)) {
cout << s[i] << " ";
}
cout << endl;
}
int main () {
cin.tie(0);
cout << setprecision(10);
ll n, a, b, c, d; cin >> n >> a >> b >> c >> d;
ll diff = abs(a-b);
if((diff > d*(n-1)) ||
(0 < && diff < c) ||
(diff == 0 && !(n % 2)) ||
(diff == c && n % 2)) {
cout << "NO" << endl;
} else {
cout << "YES" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:45:9: error: ordered comparison of pointer with integer zero ('int' and 'void*')
45 | (0 < && diff < c) ||
| ~~^~~~~~~~~
a.cc:45:14: error: label 'diff' used but not defined
45 | (0 < && diff < c) ||
| ^~~~
|
s295034529 | p03666 | C++ | #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
ll n,a,b,c,d,i,x1,x2,y1,y2;
scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);n--;
for(i=0;i<=n;i++)
{
x1=i*c;x2=(n-i)*d;y1=-i*c;y2=-(n-i)*d;
if(y1+y2<=b-a&&x1+x2>=b-a) break
}
if(i<=n||(a+c*n<=b&&a+d*n>=b)||(a-c*n>=b&&a-d*n<=b)) printf("YES\n");
else printf("NO\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:15:56: error: expected ';' before '}' token
15 | if(y1+y2<=b-a&&x1+x2>=b-a) break
| ^
| ;
16 | }
| ~
|
s840818421 | p03666 | C++ | #include<iostream>
using namespace std;
int main(){
int N,A,B,C,D;
cin>>N>>A>>B>>C>>D;
int max=0;
if(C>D) max=C-1;
else max=D;
if((B-A)/N<max) cout<<"Yes";
else cout<<"No"";
}
| a.cc:10:16: warning: missing terminating " character
10 | else cout<<"No"";
| ^
a.cc:10:16: error: missing terminating " character
10 | else cout<<"No"";
| ^~
a.cc: In function 'int main()':
a.cc:10:16: error: expected ';' before '}' token
10 | else cout<<"No"";
| ^
| ;
......
14 | }
| ~
|
s376603155 | p03666 | C++ | #include <iostream>
using namespace std;
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = {0, -1, 0, 1};
int dx[] = {1, 0, -1, 0};
llong pow(int x, int n) {
llong ans = x;
if (n == 0) return 1;
for(int i = 0; i < n - 1; i++) {
ans *= x;
}
return ans;
}
void swap(int *X, int *Y){
int t = *X; *X = *Y; *Y = t;
}
const static int MAX = 500;
int h, w;
char field[MAX][MAX];
bool flag = false, visited[MAX][MAX] = {false};
void dfs(int i, int j) {
if (field[i][j] == 'g') {
flag = true;
return;
}
if (visited[i][j]) return;
visited[i][j] = true;
rep(k, 4) {
if (0 <= i + dx[k] && i + dx[k] <= h - 1 && 0 <= j + dy[k] && j + dy[k] <= w - 1 && field[i + dx[k]][j + dy[k]] != '#') {
dfs(i + dx[k], j + dy[k]);
}
}
}
int main(){
int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
if(b >= a -d*(n-1) && b <= a + d*(n-1)) {cout << “YES” << endl;
}else {
cout << “NO” << endl;
}
return 0;
}
| a.cc:80:51: error: extended character “ is not valid in an identifier
80 | if(b >= a -d*(n-1) && b <= a + d*(n-1)) {cout << “YES” << endl;
| ^
a.cc:80:51: error: extended character ” is not valid in an identifier
a.cc:82:9: error: extended character “ is not valid in an identifier
82 | cout << “NO” << endl;
| ^
a.cc:82:9: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:80:51: error: '\U0000201cYES\U0000201d' was not declared in this scope
80 | if(b >= a -d*(n-1) && b <= a + d*(n-1)) {cout << “YES” << endl;
| ^~~~~
a.cc:82:9: error: '\U0000201cNO\U0000201d' was not declared in this scope
82 | cout << “NO” << endl;
| ^~~~
|
s209477777 | p03666 | C++ | #include <iostream>
using namespace std;
int main() {
long long n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
return 0;
}
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <random>
#include <string>
#include <bitset>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = {0, -1, 0, 1};
int dx[] = {1, 0, -1, 0};
llong pow(int x, int n) {
llong ans = x;
if (n == 0) return 1;
for(int i = 0; i < n - 1; i++) {
ans *= x;
}
return ans;
}
void swap(int *X, int *Y){
int t = *X; *X = *Y; *Y = t;
}
const static int MAX = 500;
int h, w;
char field[MAX][MAX];
bool flag = false, visited[MAX][MAX] = {false};
void dfs(int i, int j) {
if (field[i][j] == 'g') {
flag = true;
return;
}
if (visited[i][j]) return;
visited[i][j] = true;
rep(k, 4) {
if (0 <= i + dx[k] && i + dx[k] <= h - 1 && 0 <= j + dy[k] && j + dy[k] <= w - 1 && field[i + dx[k]][j + dy[k]] != '#') {
dfs(i + dx[k], j + dy[k]);
}
}
}
int main(){
int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
if(b >= a -d*(n-1) && b <= a + d*(n-1)) {cout << “YES” << endl;
}else {
cout << “NO” << endl;
}
return 0;
}
| a.cc:89:51: error: extended character “ is not valid in an identifier
89 | if(b >= a -d*(n-1) && b <= a + d*(n-1)) {cout << “YES” << endl;
| ^
a.cc:89:51: error: extended character ” is not valid in an identifier
a.cc:91:9: error: extended character “ is not valid in an identifier
91 | cout << “NO” << endl;
| ^
a.cc:91:9: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:8:72: error: invalid operands of types 'const char*' and '<unresolved overloaded function type>' to binary 'operator<<'
8 | cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:8:79: error: expected ')' before ';' token
8 | cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
| ~ ^
| )
a.cc: At global scope:
a.cc:86:5: error: redefinition of 'int main()'
86 | int main(){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:89:51: error: '\U0000201cYES\U0000201d' was not declared in this scope
89 | if(b >= a -d*(n-1) && b <= a + d*(n-1)) {cout << “YES” << endl;
| ^~~~~
a.cc:91:9: error: '\U0000201cNO\U0000201d' was not declared in this scope
91 | cout << “NO” << endl;
| ^~~~
|
s854104862 | p03666 | C++ | #include <iostream>
using namespace std;
int main() {
long long n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:72: error: invalid operands of types 'const char*' and '<unresolved overloaded function type>' to binary 'operator<<'
8 | cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:8:79: error: expected ')' before ';' token
8 | cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
| ~ ^
| )
|
s607803825 | p03666 | C++ | #include <iostream>
using namespace:std
int main() {
long long n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
return 0;
} | a.cc:2:16: error: expected identifier before ':' token
2 | using namespace:std
| ^
a.cc:2:16: error: expected ';' before ':' token
2 | using namespace:std
| ^
| ;
a.cc:2:16: error: expected unqualified-id before ':' token
|
s859017130 | p03666 | C++ | #include <iostream>
using namespace:std
int main() {
long long n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
cout << ((b <= a + d * (n - 1 ) && b >= a - d * (n - 1)? "YES" : "NO") << endl;
return 0
} | a.cc:2:16: error: expected identifier before ':' token
2 | using namespace:std
| ^
a.cc:2:16: error: expected ';' before ':' token
2 | using namespace:std
| ^
| ;
a.cc:2:16: error: expected unqualified-id before ':' token
|
s525580363 | p03666 | C | #include<stdio.h>
int main()
{
long n,a,b,c,d,e,N,x,i;
scanf_s("%ld,%ld,%ld,%ld,%ld", &n,&a,&b,&c,&d);
e = d - c;
n--;
N = n / 2;
if (a - b >= 0) {
x = a - b;
}
else {
x = b - a;
}
if (n % 2 == 0) {
for (i = 0; i <= N; i++) {
if (x <= e*N || (c*2*(N-i) -e*i)<= x <= d*2*(N-i)+e*i) {
printf("YES");
break;
}
else if(i==N) {
printf("NO");
}
}
}
else {
for (i = 0; i <= N; i++) {
if (c<=x <= e*N + d || (c * 2 * (N - i) - e*i)-d <= x <= d * 2 * (N - i) + e*i-c|| (c * 2 * (N - i) - e*i)+c <= x <= d * 2 * (N - i) + e*i+d) {
printf("YES");
break;
}
else if (i == N) {
printf("NO");
}
}
}
} | main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
6 | scanf_s("%ld,%ld,%ld,%ld,%ld", &n,&a,&b,&c,&d);
| ^~~~~~~
| scanf
|
s606534988 | p03666 | C++ | 491995 412925347 825318103 59999126 59999339 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 491995 412925347 825318103 59999126 59999339
| ^~~~~~
|
s754222007 | p03666 | C++ | #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;
#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
template<typename T, typename U>
size_t operator()(const pair<T, U> &x) const {
size_t seed = hash<T>()(x.first);
return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);
ll N, A, B, C, D;
bool solve() {
ll L = B - A + (N-1) * C;
ll R = B - A + (N-1) * D;
ll a = C + D;
for (ll k = max(0, L / a); k <= R / a + 1; k++) {
if (L <= k * a && k * a <= R)
return true;
}
return false;
}
void input() {
cin >> N >> A >> B >> C >> D;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed << setprecision(15);
input();
cout << (solve()?"YES":"NO") << endl;
}
| a.cc: In function 'bool solve()':
a.cc:53:20: error: no matching function for call to 'max(int, ll)'
53 | for (ll k = max(0, L / a); k <= R / a + 1; k++) {
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:53:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
53 | for (ll k = max(0, L / a); k <= R / a + 1; k++) {
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:53:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
53 | for (ll k = max(0, L / a); k <= R / a + 1; k++) {
| ~~~^~~~~~~~~~
|
s073709473 | p03666 | C++ | #define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
#define ll long long
using namespace std;
int main() {
ll n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
ll min_ = a;
ll max_ = a;
REP(i, n - 1) {
ll delta = b - a;
if (delta > 0) {
min_ += c;
max_ += d;
} else {
min_ -= d;
max_ -= c;
}
a = (min_ + max_) / 2;
}
if (min_ <= b && b <= max_)
cout << "YES" << endl;
| a.cc: In function 'int main()':
a.cc:42:27: error: expected '}' at end of input
42 | cout << "YES" << endl;
| ^
a.cc:21:12: note: to match this '{'
21 | int main() {
| ^
|
s448958250 | p03666 | C++ | #include "bits/stdc++.h"
#define lpa(i,a,b) for(int i=a; i<b; ++i)
#define lp(i,n) lpa(i,0,n)
using namespace std;
int main()
{
ll n,a,b,c,d,flag=0;
cin>>n>>a>>b>>c>>d;
lp(i,n) if(i*c-d*(n-1-i)<=(b-a) && (b-a)<=i*d-(n-1-i)*c) flag=1;
if(flag==1) cout<<"YES";
else cout<<"NO";
} | a.cc: In function 'int main()':
a.cc:7:9: error: 'll' was not declared in this scope; did you mean 'lp'?
7 | ll n,a,b,c,d,flag=0;
| ^~
| lp
a.cc:8:14: error: 'n' was not declared in this scope; did you mean 'yn'?
8 | cin>>n>>a>>b>>c>>d;
| ^
| yn
a.cc:8:17: error: 'a' was not declared in this scope
8 | cin>>n>>a>>b>>c>>d;
| ^
a.cc:8:20: error: 'b' was not declared in this scope
8 | cin>>n>>a>>b>>c>>d;
| ^
a.cc:8:23: error: 'c' was not declared in this scope
8 | cin>>n>>a>>b>>c>>d;
| ^
a.cc:8:26: error: 'd' was not declared in this scope
8 | cin>>n>>a>>b>>c>>d;
| ^
a.cc:9:66: error: 'flag' was not declared in this scope
9 | lp(i,n) if(i*c-d*(n-1-i)<=(b-a) && (b-a)<=i*d-(n-1-i)*c) flag=1;
| ^~~~
a.cc:10:12: error: 'flag' was not declared in this scope
10 | if(flag==1) cout<<"YES";
| ^~~~
|
s122901093 | p03666 | C++ | #include "bits/stdc++.h"
#define lpa(i,a,b) for(i=a; i<b; ++i)
#define lp(i,n) lpa(i,0,n)
using namespace std;
int main()
{
int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
a=b-a; b=0;
lp(m,n-1) if(m*c-d*(n-1-m)<=a && a<=m*d-(n-1-m)*c) b=1;
if(b==1) cout<<"YES";
else cout<<"NO";
} | a.cc: In function 'int main()':
a.cc:10:12: error: 'm' was not declared in this scope
10 | lp(m,n-1) if(m*c-d*(n-1-m)<=a && a<=m*d-(n-1-m)*c) b=1;
| ^
a.cc:2:24: note: in definition of macro 'lpa'
2 | #define lpa(i,a,b) for(i=a; i<b; ++i)
| ^
a.cc:10:9: note: in expansion of macro 'lp'
10 | lp(m,n-1) if(m*c-d*(n-1-m)<=a && a<=m*d-(n-1-m)*c) b=1;
| ^~
|
s563968535 | p03666 | C++ | #include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int n, diff, c, d, width;
int main()
{
int a, b;
cin >> n >> a >> b >> c >> d;
diff = abs(a - b);
width = abs(c - d);
n--;
while (diff - d > 0) {
diff -= d;
n--;
}
if (n % 2 == 0) {
if (diff <= width * n / 2) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} else {
cout << "NO" << endl;
}
}
return 0;
} | a.cc:28:4: error: expected unqualified-id before 'return'
28 | return 0;
| ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
29 | }
| ^
|
s381670101 | p03666 | C++ | #include "Select.h"
#if defined(B_CPP)
#include <iostream>
#include <string>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int i, j, k, l, m, n;
int H, W, N, Q;
signed long long a, b, c, d;
int main()
{
cin >> N >> a >> b >> c >> d;
unsigned long long distance;
if (a > b)
{
distance = a - b;
}
else
{
distance = b - a;
}
unsigned long long c_and_d = c + d;
signed long long left, right = d - c;
right *= (N - 1) / 2;
left = -right;
if ((N & 1) == 0)
{
left -= d;
right -= c;
}
while (distance > right)
{
left += c_and_d;
right += c_and_d;
}
if (left <= distance)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
return 0;
}
#endif | a.cc:1:10: fatal error: Select.h: No such file or directory
1 | #include "Select.h"
| ^~~~~~~~~~
compilation terminated.
|
s948963216 | p03666 | C | GNU nano 2.8.2 File: b.c Modified
#include <stdio.h>
#define abs(a) ((a)>0 ? (a) : (-(a)))
#define min(a,b) ((a)<(b) ? (a):(b))
main(){
long N,A,B,C,D;
scanf("%ld %ld %ld %ld %ld",&N,&A,&B,&C,&D);
long M=(N+1)/2-1;
long d;
if(N%2)
d=abs(A-B);
else
d=abs(abs(A-B)-(C+D)/2);
while(M>=0){
//printf("d=%ld ...\n",d);
//printf("%ld\n",(D-C)*M);
if(d<=(D-C)*M){
// puts("yes");
d=0;
break;
}
if(d-2*C>=0 && d-2*D<=0)
d=0;
else
d=min(abs(d-2*C),abs(d-2*D));
M--;
}
if(N%2){
if(d==0)
puts("YES");
else
puts("NO");
}else{
if(d<=(C-D)/2)
puts("YES");
else
puts("NO");
}
return 0;
}
| main.c:1:3: error: unknown type name 'GNU'
1 | GNU nano 2.8.2 File: b.c Modified
| ^~~
main.c:1:12: error: too many decimal points in number
1 | GNU nano 2.8.2 File: b.c Modified
| ^~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant
In file included from /usr/include/stdio.h:47,
from main.c:3:
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:28:43: error: unknown type name 'size_t'
28 | size_t __nbytes);
| ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
+++ |+#include <stddef.h>
1 | /* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: error: unknown type name 'size_t'
37 | size_t __nbytes);
| ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:57:3: error: unknown type name 'cookie_read_function_t'; did you mean 'cookie_seek_function_t'?
57 | cookie_read_function_t *read; /* Read bytes. */
| ^~~~~~~~~~~~~~~~~~~~~~
| cookie_seek_function_t
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:58:3: error: unknown type name 'cookie_write_function_t'; did you mean 'cookie_close_function_t'?
58 | cookie_write_function_t *write; /* Write bytes. */
| ^~~~~~~~~~~~~~~~~~~~~~~
| cookie_close_function_t
/usr/include/stdio.h:314:35: error: unknown type name 'size_t'
314 | extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
| ^~~~~~
/usr/include/stdio.h:130:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
129 | #include <bits/stdio_lim.h>
+++ |+#include <stddef.h>
130 |
/usr/include/stdio.h:320:47: error: unknown type name 'size_t'
320 | extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW
| ^~~~~~
/usr/include/stdio.h:320:47: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:340:34: error: unknown type name 'size_t'
340 | int __modes, size_t __n) __THROW __nonnull ((1));
| ^~~~~~
/usr/include/stdio.h:340:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:346:24: error: unknown type name 'size_t'
346 | size_t __size) __THROW __nonnull ((1));
| ^~~~~~
/usr/include/stdio.h:346:24: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:385:44: error: unknown type name 'size_t'
385 | extern int snprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~
/usr/include/stdio.h:385:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:389:45: error: unknown type name 'size_t'
389 | extern int vsnprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~
/usr/include/stdio.h:389:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:690:30: error: unknown type name 'size_t'
690 | size_t *__restrict __n, int __delimiter,
| ^~~~~~
/usr/include/stdio.h:690:30: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:693:28: error: unknown type name 'size_t'
693 | size_t *__restrict __n, int __delimiter,
| ^~~~~~
/usr/include/stdio.h:693:28: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:698:27: error: unknown type name 'size_t'
698 | size_t *__restrict __n,
| ^~~~~~
/usr/include/stdio.h:698:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:8: error: unknown type name 'size_t'
728 | extern size_t fread (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:728:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:46: error: unknown type name 'size_t'
728 | extern size_t fread (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:728:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:729:22: error: unknown type name 'size_t'
729 | size_t __n, FILE *__restrict __stream) __wur
| ^~~~~~
/usr/include/stdio.h:729:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:8: error: unknown type name 'size_t'
735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:735:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:53: error: unknown type name 'size_t'
735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:735:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:736:23: error: unknown type name 'size_t'
736 | size_t __n, FILE *__restrict __s) __nonnull((4));
| ^~~~~~
/usr/include/stdio.h:736:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:8: error: unknown type name 'size_t'
756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:756:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:55: error: unknown type name 'size_t'
756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:756:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:757:31: error: unknown type name 'size_t'
757 | size_t __n, FILE *__restrict __stream) __wur
| ^~~~~~
/usr/include/stdio.h:757:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:8: error: unknown type name 'size_t'
759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:759:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:62: error: unknown type name 'size_t'
759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:759:62: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:760:32: error: unknown type name 'size_t'
760 | size_t __n, FILE *__restrict __stream)
| ^~~~~~
/usr/include/stdio.h:760:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int]
6 | main(){
| ^~~~
|
s548211892 | p03666 | C++ | #include<iostream>
#include<utility>
#include<tuple>
#include<set>
#include<list>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FUNCTION__ << endl;
#define int long long
const long long MAXN = 1e6;
const long long MOD = 1e9+7;
const long long INF = __LONG_LONG_MAX__ / 2;
using namespace std;
vector<pair<int, int> > ranges;
vector<pair<int, int> > nextranges;
vector<pair<int, int> > result;
void mergeRange(){
sort(nextranges.begin(),nextranges.end());
vector<pair<int, int> >::iterator it = nextranges.begin();
pair<int,int> current = *(it)++;
while (it != nextranges.end()){
if (current.second > it->first){ // you might want to change it to >=
current.second = std::max(current.second, it->second);
} else {
ranges.push_back(current);
current = *(it);
}
it++;
}
ranges.push_back(current);
}
signed main(){
int N, A, B, C, D;
cin >> N >> A >> B >> C >> D;
N -= 1;
ranges.push_back(makeₚair(A,A));
for (int i = 0; i < N; i++){
cout << i << endl;
nextranges.clear();
for(auto r : ranges){
nextranges.push_back(makeₚair(r.first + C, r.second + D));
nextranges.push_back(makeₚair(r.first - D, r.second - C));
}
mergeRange();
}
for (auto r : ranges)
{
if(r.first <= B && B <= r.second){
cout << "YES" << endl;
return 0;
}
}
cout << "NO"<< endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:45:22: error: 'make\U0000209aair' was not declared in this scope
45 | ranges.push_back(makeₚair(A,A));
| ^~~~~~~~
|
s612844724 | p03666 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
for (int i = 0; i < n; i++)
{
int mn = a + i * c, mx = a + i * d;
int kek1 = mn - (n - i - 1ll) * d, kek2 = mx - (n - i - 1ll) * c;
if (b >= kek1 && b <= kek2)
{
cout << "YES";
return 0;
}
}
cout << "NO";
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s539932195 | p03666 | C++ | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <time.h>
#include<cstdio>
#include<vector>
#include<functional>
using namespace std;
long long n, a, b, c, d;
int main() {
scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
for (int i = 0; i != N; ++i){
if ((n * c - c - i * (c + d) <= b - a )&&( b- a<= n * d - d - i * (c + d))) {
printf("YES");
return 0;
}
}
printf("NO");
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:26: error: 'N' was not declared in this scope
19 | for (int i = 0; i != N; ++i){
| ^
|
s157019264 | p03666 | Java | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.math.BigDecimal;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task solver = new Task();
solver.solve(1, in, out);
out.close();
}
static class Task {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int N = in.nextInt();
int A = in.nextInt();
int B = in.nextInt();
int C = in.nextInt();
int D = in.nextInt();
int k = Math.abs(A-B);
int m = k/D;
int n = k%D;
// if(n>=C){
// n-=C;
// m++;
// }
int r = N-1-m;
// out.println(r);
// out.println(m);
int t=0;
if()
if(r%2==1){
if(C==D){
out.println("NO");
return;
}
if((n-C)%(C-D)==0) t = (n-C)/(C-D);
else t = (n-C)/(C-D)+1;
if(2*t<=r-1){
// out.println(t);
out.println("YES");
return;
}
}
else{
if(C==D){
if(n==0){
out.println("YES");
return;
}
out.println("NO");
return;
}
if(n%(D-C)==0) t = n/(D-C);
else t = n/(D-C)+1;
if(2*t<=r){
out.println("YES");
return;
}
}
// out.println(t);
out.println("NO");
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
}
} | Main.java:52: error: illegal start of expression
if()
^
1 error
|
s223602391 | p03666 | C++ | from math import gcd
N,A,B,C,D=map(int,input().split())
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, x, y = egcd(b % a, a)
return (g, y - (b // a) * x, x)
if C==0 and D==0:
if A==B:
print("YES")
else:
print("NO")
elif C==0 or D==0:
if D==0:
C,D=D,C
if (A-B)%D==0 and abs(A-B)//D<N:
print("YES")
else:
print("NO")
else:
if abs(B-A)%gcd(C,D):
print("NO")
else:
(g,x,y)=egcd(C,D)
times=(B-A)//g
#xC+yD=B-A
x*=times
y*=times
# x+=D*alpha
# y-=C*alpha
alphamin=-10**36
alphamax=10**36
while alphamax-alphamin>1:
mid=alphamin+(alphamax-alphamin)//2
if abs(x+mid*D)+abs(y-mid*C)>abs(x+mid*D+D)+abs(y-mid*C-C):
alphamin=mid
else:
alphamax=mid
x=x+alphamax*D
y=y-alphamax*C
a=[-1,0,1]
if any(abs(x+i*D)+abs(y-C*i)<N and (abs(x+i*D)+abs(y-i*D))%2!=N%2 for i in a):
print("YES")
else:
print("NO")
| a.cc:27:10: error: invalid preprocessing directive #xC
27 | #xC+yD=B-A
| ^~
a.cc:30:10: error: invalid preprocessing directive #x
30 | # x+=D*alpha
| ^
a.cc:31:10: error: invalid preprocessing directive #y
31 | # y-=C*alpha
| ^
a.cc:1:1: error: 'from' does not name a type
1 | from math import gcd
| ^~~~
|
s323194447 | p03666 | C++ | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1e9 + 7
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
double a,b,c,d;
int n;
cin >> n >> a >> b >> c >> d;
int diff = abs(a-b);
if(n%2==1)
{
if(c==d)
{
if(diff/(n-1)%d==0) cout << "YES";
else cout << "NO";
}
else if(diff/(n-1)<=d) cout << "YES";
else cout << "NO";
}
else
{
if(diff/(n-1)>=c and diff/(n-1)<=d) cout << "YES";
else cout << "NO";
}
}
| a.cc: In function 'int main()':
a.cc:21:26: error: invalid operands of types 'int' and 'double' to binary 'operator%'
21 | if(diff/(n-1)%d==0) cout << "YES";
| ~~~~~~~~~~^~
| | |
| int double
|
s801778337 | p03666 | C++ | #include <iostream>
using namespace std;
int main(void){
// Here your code !
long long int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
n=n-1;
int flag=1;
long long int x=b-a;
long long int sup=(d*n-x)/(c+d);
long long int inf=(c*n-x+c+d-1)/(c+d);
if(sup<inf){
cout<<"NO";
flag=0;
}
if(sup<0){
cout<<"NO";
flag=0
}
if(inf>n){
cout<<"NO";
flag=0;
}
if(flag){
cout<<"YES";
}
}
| a.cc: In function 'int main()':
a.cc:20:15: error: expected ';' before '}' token
20 | flag=0
| ^
| ;
21 | }
| ~
|
s559376217 | p03666 | C++ | #include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include"time.h"
using namespace std;
#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x) cerr << #x << " = " << (x) << endl
//毎回変える場所
#define N_MAX 200
//問題文のとおり
LL N,A,B,C,D;
int main() {
//入力
cin>>N>>A>>B>>C>>D;
N--;
LL AB = abs(B - A);
LL esp = abs(D - C);
LL CNum=0;
LL DNum=0;
//最近点を探す
LL temp=AB;
while (abs(temp - C*(CNum + 1))<abs(temp - C*CNum))CNum++;
while (abs(temp - D*(DNum + 1))<abs(temp - D*DNum))DNum++;
//パターン1と2
//if (D*N<abs(B - A))cout << "NO" << endl;
//else if (C*D <= abs(B - A))cout << "YES" << endl;
//else {
//Cばかりでスタートの場合
FOR(i,-1,2){
LL near = abs(temp - C*(CNum+i));
LL rest = N - (CNum+i);
if (rest % 2 == 0 && near <= esp*LL(rest / 2)){
cout << "YES" << endl;
goto end;
}
}
//Dばかりでスタートの場合
FOR(i, -1, 2) {
LL near = abs(temp - D*(DNum + i));
LL rest = N - (DNum + i);
if (rest % 2 == 0 && near <= esp*LL(rest / 2)) {
cout << "YES" << endl;
goto end;
}
}
cout<<"NO"<<endl;
/*
if (esp*int(N / 2) <= abs(B - A))cout << "YES" << endl;
else if (C - esp*int(N / 2) <= abs(B - A))cout << "YES" << endl;
else cout << "NO" << endl;
*/
//}
end:;
cin>>N;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:12: error: expected primary-expression before 'long'
17 | #define LL long long
| ^~~~
a.cc:57:58: note: in expansion of macro 'LL'
57 | if (rest % 2 == 0 && near <= esp*LL(rest / 2)){
| ^~
a.cc:57:58: error: expected ')' before 'long'
57 | if (rest % 2 == 0 && near <= esp*LL(rest / 2)){
| ~ ^
| )
a.cc:17:12: error: expected primary-expression before 'long'
17 | #define LL long long
| ^~~~
a.cc:67:58: note: in expansion of macro 'LL'
67 | if (rest % 2 == 0 && near <= esp*LL(rest / 2)) {
| ^~
a.cc:67:58: error: expected ')' before 'long'
67 | if (rest % 2 == 0 && near <= esp*LL(rest / 2)) {
| ~ ^
| )
|
s599095617 | p03666 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
int main()
{
//freopen("input.txt", "r", stdin);
ios::sync_with_stdio(0);
cin.tie(0);
int n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
int start = a - (n - 1) * d;
int len = (n - 1) * (d - c);
int space = 2 * c + (n - 2) * (c - d);
int end = a + (n - 1) * d;
if(!(start <= b && b <= end))
{
cout << "NO" << endl;
return 0;
}
if(space <= 0)
cout << "YES" << endl;
else
cout << ((b - start) % (space + len) <= space ? "YES" : "NO") << endl;
}
| a.cc:5:13: error: '::main' must return 'int'
5 | #define int int64_t
| ^~~~~~~
a.cc:7:1: note: in expansion of macro 'int'
7 | int main()
| ^~~
|
s373877530 | p03666 | C++ | /*
СТРОИМ СТЕНУ РАБОТЯГИ!
█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═█
█═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═█
█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█
*/
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
/** Interface */
inline int readChar();
template <class T = int> inline T readInt();
template <class T> inline void writeInt( T x, char end = 0 );
inline void writeChar( int x );
inline void writeWord( const char *s );
/** Read */
static const int buf_size = 4096;
inline int getChar() {
static char buf[buf_size];
static int len = 0, pos = 0;
if (pos == len) {
pos = 0, len = fread(buf, 1, buf_size, stdin);
}
if (pos == len) {
return -1;
}
return buf[pos++];
}
inline int readChar() {
int c = getChar();
while (c <= 32) {
c = getChar();
}
return c;
}
template <class T>
inline T readInt() {
int s = 1, c = readChar();
T x = 0;
if (c == '-')
s = -1, c = getChar();
while ('0' <= c && c <= '9')
x = x * 10 + c - '0', c = getChar();
return s == 1 ? x : -x;
}
/** Write */
static int write_pos = 0;
static char write_buf[buf_size];
inline void writeChar( int x ) {
if (write_pos == buf_size)
fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
write_buf[write_pos++] = x;
}
template <class T>
inline void writeInt( T x, char end ) {
if (x < 0)
writeChar('-'), x = -x;
char s[24];
int n = 0;
while (x || !n)
s[n++] = '0' + x % 10, x /= 10;
while (n--)
writeChar(s[n]);
if (end)
writeChar(end);
}
inline void writeWord( const char *s ) { while (*s)
writeChar(*s++); }
struct Flusher {
~Flusher() {
if (write_pos)
fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
}
} flusher;
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
long long n, a, b, c, d;
int main() {
cin >> n >> a >> b >> c >> d;
if (a > b) {
swap(a, b);
}
b -= a;
long long diff = sum - b;
for (long long cnt = 0; cnt <= n - 1; cnt++) {
long long left = cnt * c;
long long right = cnt * d;
left -= (n - 1 - cnt) * d;
right -= (n - 1 - cnt) * c;
if (left <= diff && right >= diff) {
cout << "YES\n";
return 0;
}
}
cout << "NO\n";
return 0;
}
| a.cc: In function 'int main()':
a.cc:140:22: error: 'sum' was not declared in this scope
140 | long long diff = sum - b;
| ^~~
|
s519854046 | p03666 | C | #include <stdio.h>
int main(void) {
int N A B C D;
scanf("%ld %ld %ld %ld %ld", &N, &A, &B, &C, &D);
if(N == 3) {
if(A <= B) {
if(C <= B - A && B - A <= D)
printf("YES");
else
printf("NO");
}
else {
if(C <= A - B && A - B <= D)
printf("YES");
else
printf("NO");
}
}
else {
if(A <= B) {
if(B <= A+D*N) {
printf("YES");
}
else {
printf("NO");
}
}
else {
if(B >= A-D*N) {
printf("YES");
}
else {
printf("NO");
}
}
}
return 0;
} | main.c: In function 'main':
main.c:4:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'A'
4 | int N A B C D;
| ^
main.c:4:9: error: unknown type name 'A'
main.c:4:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'C'
4 | int N A B C D;
| ^
main.c:6:33: error: 'N' undeclared (first use in this function)
6 | scanf("%ld %ld %ld %ld %ld", &N, &A, &B, &C, &D);
| ^
main.c:6:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:37: error: 'A' undeclared (first use in this function)
6 | scanf("%ld %ld %ld %ld %ld", &N, &A, &B, &C, &D);
| ^
main.c:6:41: error: 'B' undeclared (first use in this function)
6 | scanf("%ld %ld %ld %ld %ld", &N, &A, &B, &C, &D);
| ^
main.c:6:45: error: 'C' undeclared (first use in this function)
6 | scanf("%ld %ld %ld %ld %ld", &N, &A, &B, &C, &D);
| ^
main.c:6:49: error: 'D' undeclared (first use in this function)
6 | scanf("%ld %ld %ld %ld %ld", &N, &A, &B, &C, &D);
| ^
|
s606956931 | p03666 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) {
FastScanner scan = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int n = scan.nextInt();
long a = scan.nextInt(), b = scan.nextInt(), c = scan.nextInt(), d = scan.nextInt();
long[] z = new long[n];
z[0] = a;
z[n-1] = b;
for(int i = 1; i < n-1; i++) z[i] = z[i-1]+d;
for(int i = n-2; i >= 0; i--){
if(Math.abs(z[i]-z[i+1]) >= c && Math.abs(z[i]-z[i+1]) <= d) {
out.println("YES");
out.close();
return;
}
z[i] = z[i+1]+c;
}
for(int i = 1; i < n-1; i++) z[i] = z[i-1]-d;
for(int i = n-2; i >= 0; i--){
if(Math.abs(z[i]-z[i+1]) >= c && Math.abs(z[i]-z[i+1]) <= d) {
out.println("YES");
out.close();
return;
}
z[i] = z[i+1]-c;
}
out.println("NO");
out.close();
}
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(System.in));
st = new StringTokenizer(br.readLine());
} catch (Exception e){e.printStackTrace();}
}
public String next() {
if (st.hasMoreTokens()) return st.nextToken();
try {st = new StringTokenizer(br.readLine());}
catch (Exception e) {e.printStackTrace();}
return st.nextToken();
}
public int nextInt() {return Integer.parseInt(next());}
public long nextLong() {return Long.parseLong(next());}
public double nextDouble() {return Double.parseDouble(next());}
public String nextLine() {
String line = "";
if(st.hasMoreTokens()) line = st.nextToken();
else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
while(st.hasMoreTokens()) line += " "+st.nextToken();
return line;
}
public int[] nextIntArray(int n) {
int[] a = new int[n];
for(int i = 0; i < n; i++) a[i] = nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a = new long[n];
for(int i = 0; i < n; i++) a[i] = nextLong();
return a;
}
public double[] nextDoubleArray(int n){
double[] a = new double[n];
for(int i = 0; i < n; i++) a[i] = nextDouble();
return a;
}
public char[][] nextGrid(int n, int m){
char[][] grid = new char[n][m];
for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
return grid;
}
}
} | Main.java:8: error: class B is public, should be declared in a file named B.java
public class B {
^
1 error
|
s105937284 | p03666 | C++ | #include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;
const int inf=1000000009;
typedef double db;
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
int rd() {
char c=getchar(); int t=0,f=1;
while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
if (x<0) putchar('-'),wt(-x);
else { if (x>9) wt(x/10); putchar(x%10+48); }
}
ll n,A,B,C,D,dis,p,t,l,r,mid,da,L,R;
int main() {
n=rd()-1,A=rd(),B=rd(),C=rd(),D=rd();
dis=abs(B-A),p=D-C;
l=0,r=n/2;
while (l<=r) {
mid=l+r>>1;
da=mid*2+(n&1);
L=da*C-p*((n-da)/2);
R=da*D+p*((n-da)/2);
if (L<=dis && dis<=R)
return puts("YES"),0;
else
{ if (R<dis) l=mid+1; }
else
r=mid-1;
}
return puts("NO");
return 0;
}
| a.cc: In function 'int main()':
a.cc:55:17: error: 'else' without a previous 'if'
55 | else
| ^~~~
|
s887836718 | p03667 | C++ | #include <bits/stdc++.h>
#include <omp.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int, int> pii;
typedef pair<string, string> pst;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef pair<pld, pld> pldd;
typedef vector<pld> vpd;
typedef complex<double> base;
#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define my_abs(a) (((a) >= 0) ? (a) : -(a))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define MODIK(a) (a >= M ? a - M : a)
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef ART_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif
const double PI = 2 * acos(0.0);
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";
istream &operator >> (istream &in, pii &a)
{
in >> a.first >> a.second;
return in;
}
ostream &operator << (ostream &out, pii &a)
{
out << a.first << ' ' << a.second;
return out;
}
istream &operator >> (istream &in, pld &a)
{
in >> a.first >> a.second;
return in;
}
ostream &operator << (ostream &out, pld &a)
{
out << a.first << ' ' << a.second;
return out;
}
template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
return out << "{" << a.first << ", " << a.second << "}";
}
template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}
template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
return out << "{" << get<0>(a) << ", " << get<1>(a) <<
", " << get<2>(a) << ", " << get<3>(a) << "}";
}
template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
out << "[";
fori (i, a.size())
out << a[i] << vector<string>{", ", "] "}[i + 1 == a.size()];
return out;
}
void print(int a, int b, int n, vi h)
{
ofstream cout("output.txt");
cout << SZ(h) << ' ' << a << ' ' << b << '\n';
for (int i = 0; i < SZ(h); ++i) {
cout << h[i] << ' ';
}
cout.close();
exit(0);
}
inline bool break_time(ld time)
{
return clock() > CLOCKS_PER_SEC * time;
}
ld get_rand_ld(ld l, ld r)
{
uniform_real_distribution<double> gen(l, r);
return gen(rng);
}
bool may(int E, ld T)
{
if (E < 0)
return 1;
double eps = get_rand_ld(0, 1);
return eps < exp(-E / T);
}
void smain();
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifdef ART_HOME
freopen("input.txt", "r", stdin);
clock_t start = clock();
#endif
cout << setprecision(12) << fixed;
smain();
#ifdef ART_HOME
cout << "\nTOTAL EXECUTIOn TIME: " << float( clock () - start ) / CLOCKS_PER_SEC << endl;
#endif
}
const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
const int M1 = 1000000093, x1 = 27162;
const int M2 = 1000000087, x2 = 241;
const ld pi = atan2(1, 0) * 2;
int cnt[N];
void smain() {
int n, q;
cin >> n >> q;
vi kek(n);
for (int i = 0; i < n; ++i)
cin >> kek[i];
for (int i = 0; i < q; ++i)
{
fill(cnt, cnt + N, 0);
for (int j = 1; j <= n; ++j)
cnt[j] -= j;
int ind, v;
cin >> ind >> v;
ind--;
kek[ind] = v;
for (int u : kek)
cnt[u]++;
int last = 0;
int ans = 0;
while (last != n)
{
int mx = -1;
for (int j = last + 1; j <= n; ++j)
mx = max(mx, cnt[j] + last);
if (mx < 0)
{
ans += -(cnt[last + 1] + last);
last++;
}
else {
int ls = 0;
for (int j = last + 1; j <= n; ++j)
if (cnt[j] + last >= 0)
{
ls = j;
break;
}
last = ls;
}
}
cout << ans << '\n';
}
}#include <bits/stdc++.h>
#include <omp.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int, int> pii;
typedef pair<string, string> pst;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef pair<pld, pld> pldd;
typedef vector<pld> vpd;
typedef complex<double> base;
#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define my_abs(a) (((a) >= 0) ? (a) : -(a))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define MODIK(a) (a >= M ? a - M : a)
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef ART_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif
const double PI = 2 * acos(0.0);
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";
istream &operator >> (istream &in, pii &a)
{
in >> a.first >> a.second;
return in;
}
ostream &operator << (ostream &out, pii &a)
{
out << a.first << ' ' << a.second;
return out;
}
istream &operator >> (istream &in, pld &a)
{
in >> a.first >> a.second;
return in;
}
ostream &operator << (ostream &out, pld &a)
{
out << a.first << ' ' << a.second;
return out;
}
template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
return out << "{" << a.first << ", " << a.second << "}";
}
template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}
template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
return out << "{" << get<0>(a) << ", " << get<1>(a) <<
", " << get<2>(a) << ", " << get<3>(a) << "}";
}
template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
out << "[";
fori (i, a.size())
out << a[i] << vector<string>{", ", "] "}[i + 1 == a.size()];
return out;
}
void print(int a, int b, int n, vi h)
{
ofstream cout("output.txt");
cout << SZ(h) << ' ' << a << ' ' << b << '\n';
for (int i = 0; i < SZ(h); ++i) {
cout << h[i] << ' ';
}
cout.close();
exit(0);
}
inline bool break_time(ld time)
{
return clock() > CLOCKS_PER_SEC * time;
}
ld get_rand_ld(ld l, ld r)
{
uniform_real_distribution<double> gen(l, r);
return gen(rng);
}
bool may(int E, ld T)
{
if (E < 0)
return 1;
double eps = get_rand_ld(0, 1);
return eps < exp(-E / T);
}
void smain();
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifdef ART_HOME
freopen("input.txt", "r", stdin);
clock_t start = clock();
#endif
cout << setprecision(12) << fixed;
smain();
#ifdef ART_HOME
cout << "\nTOTAL EXECUTIOn TIME: " << float( clock () - start ) / CLOCKS_PER_SEC << endl;
#endif
}
const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
const int M1 = 1000000093, x1 = 27162;
const int M2 = 1000000087, x2 = 241;
const ld pi = atan2(1, 0) * 2;
int cnt[N];
void smain() {
int n, q;
cin >> n >> q;
vi kek(n);
for (int i = 0; i < n; ++i)
cin >> kek[i];
for (int i = 0; i < q; ++i)
{
fill(cnt, cnt + N, 0);
for (int j = 1; j <= n; ++j)
cnt[j] -= j;
int ind, v;
cin >> ind >> v;
ind--;
kek[ind] = v;
for (int u : kek)
cnt[u]++;
int last = 0;
int ans = 0;
while (last != n)
{
int mx = -1;
for (int j = last + 1; j <= n; ++j)
mx = max(mx, cnt[j] + last);
if (mx < 0)
{
ans += -(cnt[last + 1] + last);
last++;
}
else {
int ls = 0;
for (int j = last + 1; j <= n; ++j)
if (cnt[j] + last >= 0)
{
ls = j;
break;
}
last = ls;
}
}
cout << ans << '\n';
}
} | a.cc:235:2: error: stray '#' in program
235 | }#include <bits/stdc++.h>
| ^
a.cc:235:3: error: 'include' does not name a type
235 | }#include <bits/stdc++.h>
| ^~~~~~~
a.cc:247:9: error: redefinition of 'std::mt19937 rng'
247 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
| ^~~
a.cc:13:9: note: 'std::mt19937 rng' previously declared here
13 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
| ^~~
a.cc:248:12: error: redefinition of 'std::mt19937_64 rng_64'
248 | mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());
| ^~~~~~
a.cc:14:12: note: 'std::mt19937_64 rng_64' previously declared here
14 | mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());
| ^~~~~~
a.cc:297:14: error: redefinition of 'const double PI'
297 | const double PI = 2 * acos(0.0);
| ^~
a.cc:63:14: note: 'const double PI' previously defined here
63 | const double PI = 2 * acos(0.0);
| ^~
a.cc:299:14: error: redefinition of 'const std::string DIGITS'
299 | const string DIGITS = "0123456789";
| ^~~~~~
a.cc:65:14: note: 'const std::string DIGITS' previously declared here
65 | const string DIGITS = "0123456789";
| ^~~~~~
a.cc:300:14: error: redefinition of 'const std::string ALPH'
300 | const string ALPH = "abcdefghijklmnopqrstuvwxyz";
| ^~~~
a.cc:66:14: note: 'const std::string ALPH' previously declared here
66 | const string ALPH = "abcdefghijklmnopqrstuvwxyz";
| ^~~~
a.cc:302:10: error: redefinition of 'std::istream& operator>>(std::istream&, pii&)'
302 | istream &operator >> (istream &in, pii &a)
| ^~~~~~~~
a.cc:68:10: note: 'std::istream& operator>>(std::istream&, pii&)' previously defined here
68 | istream &operator >> (istream &in, pii &a)
| ^~~~~~~~
a.cc:309:10: error: redefinition of 'std::ostream& operator<<(std::ostream&, pii&)'
309 | ostream &operator << (ostream &out, pii &a)
| ^~~~~~~~
a.cc:75:10: note: 'std::ostream& operator<<(std::ostream&, pii&)' previously defined here
75 | ostream &operator << (ostream &out, pii &a)
| ^~~~~~~~
a.cc:316:10: error: redefinition of 'std::istream& operator>>(std::istream&, pld&)'
316 | istream &operator >> (istream &in, pld &a)
| ^~~~~~~~
a.cc:82:10: note: 'std::istream& operator>>(std::istream&, pld&)' previously defined here
82 | istream &operator >> (istream &in, pld &a)
| ^~~~~~~~
a.cc:323:10: error: redefinition of 'std::ostream& operator<<(std::ostream&, pld&)'
323 | ostream &operator << (ostream &out, pld &a)
| ^~~~~~~~
a.cc:89:10: note: 'std::ostream& operator<<(std::ostream&, pld&)' previously defined here
89 | ostream &operator << (ostream &out, pld &a)
| ^~~~~~~~
a.cc:331:18: error: redefinition of 'template<class T0, class T1> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>&)'
331 | inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
| ^~~~~~~~
a.cc:97:18: note: 'template<class T0, class T1> std::ostream& operator<<(std::ostream&, std::pair<_T1, _T2>&)' previously declared here
97 | inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
| ^~~~~~~~
a.cc:336:18: error: redefinition of 'template<class T0, class T1, class T2> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2>&)'
336 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
| ^~~~~~~~
a.cc:102:18: note: 'template<class T0, class T1, class T2> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2>&)' previously declared here
102 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
| ^~~~~~~~
a.cc:341:18: error: redefinition of 'template<class T0, class T1, class T2, class T3> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2, T3>&)'
341 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
| ^~~~~~~~
a.cc:107:18: note: 'template<class T0, class T1, class T2, class T3> std::ostream& operator<<(std::ostream&, std::tuple<T0, T1, T2, T3>&)' previously declared here
107 | inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
| ^~~~~~~~
a.cc:347:18: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)'
347 | inline ostream & operator << (ostream &out, vector<T> &a) {
| ^~~~~~~~
a.cc:113:18: note: 'template<class T> std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)' previously declared here
113 | inline ostream & operator << (ostream &out, vector<T> &a) {
| ^~~~~~~~
a.cc:355:6: error: redefinition of 'void print(ll, ll, ll, vi)'
355 | void print(int a, int b, int n, vi h)
| ^~~~~
a.cc:121:6: note: 'void print(ll, ll, ll, vi)' previously defined here
121 | void print(int a, int b, int n, vi h)
| ^~~~~
a.cc:367:13: error: redefinition of 'bool break_time(ld)'
367 | inline bool break_time(ld time)
| ^~~~~~~~~~
a.cc:133:13: note: 'bool break_time(ld)' previously defined here
133 | inline bool break_time(ld time)
| ^~~~~~~~~~
a.cc:373:4: error: redefinition of 'ld get_rand_ld(ld, ld)'
373 | ld get_rand_ld(ld l, ld r)
| ^~~~~~~~~~~
a.cc:139:4: note: 'ld get_rand_ld(ld, ld)' previously defined here
139 | ld get_rand_ld(ld l, ld r)
| ^~~~~~~~~~~
a.cc:380:6: error: redefinition of 'bool may(ll, ld)'
380 | bool may(int E, ld T)
| ^~~
a.cc:146:6: note: 'bool may(ll, ld)' previously defined here
146 | bool may(int E, ld T)
| ^~~
a.cc:392:8: error: redefinition of 'int main()'
392 | signed main() {
| ^~~~
a.cc:158:8: note: 'int main()' previously defined here
158 | signed main() {
| ^~~~
a.cc:408:11: error: redefinition of 'const ll N'
408 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:174:11: note: 'const ll N' previously defined here
174 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:408:25: error: redefinition of 'const ll K'
408 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:174:25: note: 'const ll K' previously defined here
174 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:408:39: error: redefinition of 'const ll B'
408 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:174:39: note: 'const ll B' previously defined here
174 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:408:48: error: redefinition of 'const ll oo'
408 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^~
a.cc:174:48: note: 'const ll oo' previously defined here
174 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^~
a.cc:408:64: error: redefinition of 'const ll M'
408 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:174:64: note: 'const ll M' previously defined here
174 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^
a.cc:408:77: error: redefinition of 'const ll LOG'
408 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^~~
a.cc:174:77: note: 'const ll LOG' previously defined here
174 | const int N = 2e2 + 10, K = 1e2 + 10, B = 400, oo = 1e9 + 100, M = 1e9 + 7, LOG = 20;
| ^~~
a.cc:409:11: error: redefinition of 'const ll M1'
409 | const int M1 = 1000000093, x1 = 27162;
| ^~
a.cc:175:11: note: 'const ll M1' previously defined here
175 | const int M1 = 1000000093, x1 = 27162;
| ^~
a.cc:409:28: error: redefinition of 'const ll x1'
409 | const int M1 = 1000000093, x1 = 27162;
| ^~
a.cc:175:28: note: 'const ll x1' previously defined here
175 | const int M1 = 1000000093, x1 = 27162;
| ^~
a.cc:410:11: error: redefinition of 'const ll M2'
410 | const int M2 = 1000000087, x2 = 241;
| ^~
a.cc:176:11: note: 'const ll M2' previously defined here
176 | const int M2 = 1000000087, x2 = 241;
| ^~
a.cc:410:28: error: redefinition of 'const ll x2'
410 | const int M2 = 1000000087, x2 = 241;
| ^~
a.cc:176:28: note: 'const ll x2' previously defined here
176 | const int M2 = 1000000087, x2 = 241;
| ^~
a.cc:411:10: error: redefinition of 'const ld pi'
411 | const ld pi = atan2(1, 0) * 2;
| ^~
a.cc:177:10: note: 'const ld pi' previously defined here
177 | const ld pi = atan2(1, 0) * 2;
| ^~
a.cc:414:5: error: redefinition of 'll cnt [210]'
414 | int cnt[N];
| ^~~
a.cc:180:5: note: 'll cnt [210]' previously declared here
180 | int cnt[N];
| ^~~
a.cc:417:6: error: redefinition of 'void smain()'
417 | void smain() {
| ^~~~~
a.cc:183:6: note: 'void smain()' previously defined here
183 | void smain() {
| ^~~~~
|
s182281092 | p03667 | C++ | fn read<T: std::str::FromStr>() -> T {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
read::<String>()
.split_whitespace()
.map(|e| e.parse().ok().unwrap())
.collect()
}
fn main() {
let v = read_vec::<usize>();
let (n, m) = (v[0], v[1]);
let mut a = read_vec::<usize>();
let mut x = Vec::with_capacity(m);
let mut y = Vec::with_capacity(m);
for i in 0..m {
let v = read_vec::<usize>();
x.push(v[0] - 1);
y.push(v[1]);
}
let mut count = vec![0; n + 1];
for &num in a.iter() {
count[num] += 1;
}
let mut span = vec![0; n];
for i in 1..n + 1 {
for j in 0..count[i] {
if i >= j + 1 {
span[i - j - 1] += 1;
}
}
}
// println!("count {:?}", count);
// println!("span {:?}", span);
let mut blank_count = 0;
for i in 0..n {
if span[i] == 0 {
blank_count += 1;
}
}
for i in 0..m {
let x = x[i];
let y = y[i];
if a[x] >= count[a[x]] {
span[a[x] - count[a[x]]] -= 1;
if span[a[x] - count[a[x]]] == 0 {
blank_count += 1;
}
}
count[a[x]] -= 1;
a[x] = y;
count[y] += 1;
if y >= count[y] {
span[y - count[y]] += 1;
if span[y - count[y]] == 1 {
blank_count -= 1;
}
}
// println!("count {:?}", count);
// println!("span {:?}", span);
println!("{:?}", blank_count);
}
}
| a.cc:21:14: error: too many decimal points in number
21 | for i in 0..m {
| ^~~~
a.cc:32:14: error: too many decimal points in number
32 | for i in 1..n + 1 {
| ^~~~
a.cc:33:18: error: too many decimal points in number
33 | for j in 0..count[i] {
| ^~~~~~~~
a.cc:43:14: error: too many decimal points in number
43 | for i in 0..n {
| ^~~~
a.cc:49:14: error: too many decimal points in number
49 | for i in 0..m {
| ^~~~
a.cc:1:1: error: 'fn' does not name a type
1 | fn read<T: std::str::FromStr>() -> T {
| ^~
a.cc:7:1: error: 'fn' does not name a type
7 | fn read_vec<T: std::str::FromStr>() -> Vec<T> {
| ^~
a.cc:14:1: error: 'fn' does not name a type
14 | fn main() {
| ^~
|
s401321793 | p03667 | C++ | #include<cstdio> #define fo(i,a,b) for(int i=a;i<=b;i++) using namespace std; const int maxn=2e5+5; int n,a[maxn],num[maxn]; int ans,cov[maxn]; void ADD(int x) { if (x<=0) return; if (++cov[x]==1) ans++; } void DEC(int x) { if (x<=0) return; if (--cov[x]==0) ans--; } int m; int main() { scanf("%d %d",&n,&m); fo(i,1,n) { scanf("%d",&a[i]); num[a[i]]++; ADD(a[i]-num[a[i]]+1); } while (m--) { int x,y; scanf("%d %d",&x,&y); DEC(a[x]-num[a[x]]+1); num[a[x]]--; num[y]++; ADD(y-num[y]+1); a[x]=y; printf("%d\n",n-ans); } } | a.cc:1:18: warning: extra tokens at end of #include directive
1 | #include<cstdio> #define fo(i,a,b) for(int i=a;i<=b;i++) using namespace std; const int maxn=2e5+5; int n,a[maxn],num[maxn]; int ans,cov[maxn]; void ADD(int x) { if (x<=0) return; if (++cov[x]==1) ans++; } void DEC(int x) { if (x<=0) return; if (--cov[x]==0) ans--; } int m; int main() { scanf("%d %d",&n,&m); fo(i,1,n) { scanf("%d",&a[i]); num[a[i]]++; ADD(a[i]-num[a[i]]+1); } while (m--) { int x,y; scanf("%d %d",&x,&y); DEC(a[x]-num[a[x]]+1); num[a[x]]--; num[y]++; ADD(y-num[y]+1); a[x]=y; printf("%d\n",n-ans); } }
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s045772676 | p03667 | C++ | #include<bits/stdc++.h>
using namespace std;
map<long long, long long> ccount;
long long N, M;
long long A[200005];
long long NUM[200005];
long long X[200005];
long long Y[200005];
bool paint[200005];
int main(){
cin >> N >> M;
for(long long i = 0; i < N; i++){
cin >> A[i];
NUM[A[i]]++;
}
for(long long i = 0; i < M; i++){
cin >> X[i] >> Y[i];
}
if(N > 200 || M > 200){
return 1;
}
for(long long i = 0; i < M; i++){
long long from = A[X[i] - 1];
long long to = Y[i];
NUM[from]--;
NUM[to]++;
A[X[i] - 1] = to;
long long ans = 0;
for(long long j = 0; j <= N; j++){
paint[j] = false;
}
for(long long j = N; j >= 0; j--){
if(j != N && paint[j] == false){
ans++;
}
if(NUM[j] > 0){
for(long long k = 0; k < NUM[j]; k++){
paint[max(0, j - 1 - k)] = true;
}
}
}
cout << ans << endl;
}
}
| a.cc: In function 'int main()':
a.cc:44:50: error: no matching function for call to 'max(int, long long int)'
44 | paint[max(0, j - 1 - k)] = true;
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:44:50: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
44 | paint[max(0, j - 1 - k)] = true;
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:44:50: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
44 | paint[max(0, j - 1 - k)] = true;
| ~~~^~~~~~~~~~~~~~
|
s659766319 | p03667 | C++ | if (d[i] == 0) {
res++;
} | a.cc:1:1: error: expected unqualified-id before 'if'
1 | if (d[i] == 0) {
| ^~
|
s051497684 | p03667 | C++ | #include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
using namespace std;
#define ll long long int
#define pii pair<ll,ll>
struct sequence_
{
static const int N=2e5+10;
int n,m,h[N],b[N],a[N];
sequence_(int n_, int m_) : n(n_), m(m_){}
bool add(int x, int index)
{
a[index] = x;
int y=x-h[x];
y=max(1,y);
b[y]++;
h[x]++;
if(b[y] > 1)
{
return true;
}
return false;
}
int swap(int x, int y)
{
int ans = 0;
h[a[x]]--;
int z=a[x]-h[a[x]];
z=max(z,1);
b[z]--;
if(b[z]==0) ans++;
z=y-h[y];
z=max(z,1);
if(b[z]==0) ans--;
b[z]++;
h[y]++;
a[x]=y;
return ans;
}
};
int main()
{
int n, m;
scanf("%d%d",&n,&m);
sequence_ s(n,m);
int ans=0;
for(int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
if(s.add(x))
{
ans++;
}
}
while(m--)
{
int x,y;
scanf("%d%d",&x,&y);
ans += s.swap(x, y);
printf("%d\n",ans);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:72:17: error: no matching function for call to 'sequence_::add(int&)'
72 | if(s.add(x))
| ~~~~~^~~
a.cc:29:10: note: candidate: 'bool sequence_::add(int, int)'
29 | bool add(int x, int index)
| ^~~
a.cc:29:10: note: candidate expects 2 arguments, 1 provided
|
s920524277 | p03667 | C++ | #include <iostream>
#include <string>
using namespace std;
int cnt[200001];
int cover[200001];
int val[200001];
int main()
{
memset(cnt, 0, sizeof(cnt));
memset(cover, 0, sizeof(cover));
int N, M;
cin >> N >> M;
for (int i = 1; i <= N; i++) {
int a;
cin >> a;
val[i] = a;
cnt[a]++;
int pos = a - cnt[a] + 1;
if (pos > 0) cover[pos]++;
}
int exs = 0;
for (int i = 1; i <= N; i++) {
if (cover[i] == 0) exs++;
}
for (int i = 1; i <= M; i++) {
int X, Y;
cin >> X >> Y;
int minus = val[X];
int plus = Y;
val[X] = Y;
int pos = minus - cnt[minus] + 1;
if (pos > 0) {
if (cover[pos] == 1) exs++;
cover[pos]--;
}
cnt[minus]--;
cnt[plus]++;
pos = plus - cnt[plus] + 1;
if (pos > 0) {
if (cover[pos] == 0) exs--;
cover[pos]++;
}
cout << exs << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
11 | memset(cnt, 0, sizeof(cnt));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
|
s136461288 | p03667 | C++ | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 200000+10;
int cnt[MAXN<<1];
int cover[MAXN<<1];
int array[MAXN<<1];
int res=0;
int N,M;
void check(){
cout<<"--------------------------------"<<endl;
vector<int> a(array+1,array+N+1);
sort(a.begin(),a.end());
cout<<"array:\t";
for(int i=1;i<=N;i++){
printf("%4d",array[i]);
}
cout<<endl;
cout<<"sorted:\t";
for(int i=1;i<=N;i++){
printf("%4d",a[i-1]);
}
cout<<endl;
cout<<"===="<<endl;
cout<<"cover:\t";
for(int i=1;i<=N;i++){
printf("%3d:%d",i,cover[i]);
}
cout<<endl;
cout<<"--------------------------------"<<endl;
}
int main(){
res=0;
scanf("%d%d",&N,&M);
for(int i=1;i<=N;i++){
scanf("%d",array+i);
cnt[array[i]]++;
}
for(int i=N;i>0;i--){
int j=cnt[i];
while(j--){
if(i>j) cover[i-j]++;
}
}
for(int i=1;i<=N;i++){
res+=(cover[i]==0);
}
int X,Y;
int num;
//cout<<res<<endl;
for(int i=0;i<M;i++){
scanf("%d%d",&X,&Y);
num=array[X];
array[X]=Y;
cnt[num]--;
if(num-cnt[num]>0) --cover[num-cnt[num]];
if((num-cnt[num]>0)&&(0==cover[num-cnt[num]])) res++;
cnt[Y]++;
if(Y-cnt[Y]+1>0) ++cover[Y-cnt[Y]+1];
if((Y-cnt[Y]+1>0)&&(1==cover[Y-cnt[Y]+1])) res--;
printf("%d\n",res);
//check();
}
return 0;
} | a.cc: In function 'void check()':
a.cc:15:24: error: reference to 'array' is ambiguous
15 | vector<int> a(array+1,array+N+1);
| ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:8:5: note: 'int array [400020]'
8 | int array[MAXN<<1];
| ^~~~~
a.cc:15:32: error: reference to 'array' is ambiguous
15 | vector<int> a(array+1,array+N+1);
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:8:5: note: 'int array [400020]'
8 | int array[MAXN<<1];
| ^~~~~
a.cc:21:30: error: reference to 'array' is ambiguous
21 | printf("%4d",array[i]);
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:8:5: note: 'int array [400020]'
8 | int array[MAXN<<1];
| ^~~~~
a.cc: In function 'int main()':
a.cc:49:28: error: reference to 'array' is ambiguous
49 | scanf("%d",array+i);
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:8:5: note: 'int array [400020]'
8 | int array[MAXN<<1];
| ^~~~~
a.cc:50:21: error: reference to 'array' is ambiguous
50 | cnt[array[i]]++;
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:8:5: note: 'int array [400020]'
8 | int array[MAXN<<1];
| ^~~~~
a.cc:67:21: error: reference to 'array' is ambiguous
67 | num=array[X];
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:8:5: note: 'int array [400020]'
8 | int array[MAXN<<1];
| ^~~~~
a.cc:68:17: error: reference to 'array' is ambiguous
68 | array[X]=Y;
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
99 | struct array;
| ^~~~~
a.cc:8:5: note: 'int array [400020]'
8 | int array[MAXN<<1];
| ^~~~~
|
s226729908 | p03667 | C++ | #include <bits/stdc++.h>
#define M 100005
#define N 1005
#define ll long long
#define oo 1000000000
#define mod 5557
using namespace std;
int A[M],B[M],ans,n,m,dp[M],cnt[M],V[M][M],sum[M],t;
void check(int &a,int b){
if(a==-1||a>b)a=b;
}
int main(){
int i,j,a,b;
cin>>n>>m;
for(i=1;i<=n;i++){
scanf("%d",&A[i]);
cnt[A[i]]++;
}
for(i=1;i<=n;i++){
for(j=min(cnt[i],i)-1;j>=0;j--){
if(!sum[i-j])++t;
sum[i-j]++;
}
}
for(i=1;i<=m;i++){
scanf("%d %d",&a,&b);
cnt[A[a]]--;
if(A[a]-cnt[A[a]]>0&&!(--sum[A[a]-cnt[A[a]]]))--t;
A[a]=b;
if(A[a]-cnt[A[a]]>0&&!sum[A[a]-cnt[A[a]]]++)++t;
++cnt[A[a]];
printf("%d\n",n-t);
}
return 0;
}
| /tmp/ccVUlZqd.o: in function `main':
a.cc:(.text+0x146): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x153): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x18b): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x2c4): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x2dc): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x2f0): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x30d): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x316): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccVUlZqd.o
a.cc:(.text+0x3cf): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s864009875 | p03667 | C++ | #include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
int a[N], cnt[N], b[N];
int main() {
int n, tt;
scanf("%d %d", &n, &tt);
int empty = n;
for (int i = 1; i <= n; i++) {
scanf("%d", a + i);
cnt[a[i]]++;
int pos = a[i] - cnt[a[i]] + 1;
if (pos >= 1) {
if (b[pos] == 0) {
empty--;
}
b[pos]++;
}
}
while (tt--) {
int x, y;
scanf("%d %d", &x, &y);
{
int pos = a[x] - cnt[a[x]] + 1;
if (pos >= 1) {
b[posa]--;
if (b[pos] == 0) {
empty++;
}
}
}
cnt[a[x]]--;
a[x] = y;
cnt[a[x]]++;
{
int pos = a[x] - cnt[a[x]] + 1;
if (pos >= 1) {
if (b[pos] == 0) {
empty--;
}
b[pos]++;
}
}
printf("%d\n", empty);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:30:15: error: 'posa' was not declared in this scope; did you mean 'pos'?
30 | b[posa]--;
| ^~~~
| pos
|
s603591633 | p03667 | C++ | if(p>0 && br[p]==0) ++emp;
}
int main(){
cin>>n>>m;
emp=n;
REP(i,n){
scanf("%d",&ar[i]);
add(ar[i]);
}
REP(hoge,m){
int x,y;scanf("%d%d",&x,&y);--x;
rem(ar[x]);
add(y);
ar[x]=y;
printf("%d\n",emp);
}
return 0;
}
| a.cc:1:3: error: expected unqualified-id before 'if'
1 | if(p>0 && br[p]==0) ++emp;
| ^~
a.cc:2:1: error: expected declaration before '}' token
2 | }
| ^
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
4 | cin>>n>>m;
| ^~~
a.cc:4:8: error: 'n' was not declared in this scope
4 | cin>>n>>m;
| ^
a.cc:4:11: error: 'm' was not declared in this scope
4 | cin>>n>>m;
| ^
a.cc:5:3: error: 'emp' was not declared in this scope
5 | emp=n;
| ^~~
a.cc:6:7: error: 'i' was not declared in this scope
6 | REP(i,n){
| ^
a.cc:6:3: error: 'REP' was not declared in this scope
6 | REP(i,n){
| ^~~
a.cc:10:7: error: 'hoge' was not declared in this scope
10 | REP(hoge,m){
| ^~~~
|
s897162893 | p03667 | C++ | #include <bits/stdc++.h>
using namespace std;
#include <vector>
#define vi vector<int>
#define pb push_back
const int N = 100005;
int FREQ[N], FREQ2[N];
int dp[N][N];
const int INF = 100000000;
int A[N];
int ans(int n){
memset(FREQ, 0, sizeof FREQ);
for(int i = 1; i <= n; i++) FREQ[A[i]]++;
for(int i = 1; i <= n; i++) FREQ2[i] = FREQ2[i - 1] + FREQ[i];
for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) dp[i][j] = INF;
dp[0][0] = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
for(int k = 1; k <= i && k <= j; k++){
dp[i][j] = min(dp[i][j], dp[i - k][j - k] + abs(FREQ[i] - k) + FREQ2[i - 1] - FREQ2[i - k]);
}
}
}
return dp[n][n] / 2;
}
int main(){
int n, m;
cin>> n >> m;
for(int i = 1; i <= n; i++) cin >> A[i];
cerr << ans(n) << endl;
for(int i = 1; i <= m; i++){
int x, y;
cin >> x >> y;
A[x] = y;
cout << ans(n) << endl;
}
} | /tmp/ccdUVmUX.o: in function `ans(int)':
a.cc:(.text+0x3d): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccdUVmUX.o
/tmp/ccdUVmUX.o: in function `main':
a.cc:(.text+0x2f1): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccdUVmUX.o
a.cc:(.text+0x388): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccdUVmUX.o
collect2: error: ld returned 1 exit status
|
s299793768 | p03667 | C++ | #include <bits/stdc++.h>
using namespace std;
#include <vector>
#define vi vector<int>
#define pb push_back
const int N = 100005;
int freq[N], freq2[N];
int dp[N][N];
const int INF = 100000000;
int A[N];
int ans(int n){
memset(freq, 0, sizeof freq);
for(int i = 1; i <= n; i++) freq[A[i]]++;
for(int i = 1; i <= n; i++) freq2[i] = freq2[i - 1] + freq[i];
for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) dp[i][j] = INF;
dp[0][0] = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
for(int k = 1; k <= i && k <= j; k++){
dp[i][j] = min(dp[i][j], dp[i - k][j - k] + abs(freq[i] - k) + freq2[i - 1] - freq2[i - k]);
}
}
}
return dp[n][n] / 2;
}
int main(){
int n, m;
cin>> n >> m;
for(int i = 1; i <= n; i++) cin >> A[i];
cerr << ans(n) << endl;
for(int i = 1; i <= m; i++){
int x, y;
cin >> x >> y;
A[x] = y;
cout << ans(n) << endl;
}
} | /tmp/ccWwlofg.o: in function `ans(int)':
a.cc:(.text+0x3d): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccWwlofg.o
/tmp/ccWwlofg.o: in function `main':
a.cc:(.text+0x2f1): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccWwlofg.o
a.cc:(.text+0x388): relocation truncated to fit: R_X86_64_PC32 against symbol `A' defined in .bss section in /tmp/ccWwlofg.o
collect2: error: ld returned 1 exit status
|
s106607795 | p03667 | C++ | #include <iostream>
using namespace std;
#include <vector>
#define vi vector<int>
#define pb push_back
const int N = 100005;
int freq[N], freq2[N];
int dp[N][N];
const int INF = 100000000;
int A[N];
int ans(int n){
memset(freq, 0, sizeof freq);
for(int i = 1; i <= n; i++) freq[A[i]]++;
for(int i = 1; i <= n; i++) freq2[i] = freq2[i - 1] + freq[i];
for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) dp[i][j] = INF;
dp[0][0] = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
// add for i - 1, ... , i - k + 1
// freq2[i - 1] - freq2[i - k]
for(int k = 1; k <= i && k <= j; k++){
dp[i][j] = min(dp[i][j], dp[i - k][j - k] + abs(freq[i] - k) + freq2[i - 1] - freq2[i - k]);
if(i == 5 && j == 5){
// cerr << k << " " << dp[i - k][j - k] + freq2[i - 1] - freq2[i - k] << " " << abs(freq[i] - k) << endl;
}
}
}
}
// cerr << dp[2][2] << " " << dp[3][3] << " " << dp[4][4] << " " << dp[5][5] << endl;
return dp[n][n] / 2;
}
int main(){
int n, m;
cin>> n >> m;
for(int i = 1; i <= n; i++) cin >> A[i];
cerr << ans(n) << endl;
for(int i = 1; i <= m; i++){
int x, y;
cin >> x >> y;
A[x] = y;
cout << ans(n) << endl;
}
} | a.cc: In function 'int ans(int)':
a.cc:12:5: error: 'memset' was not declared in this scope
12 | memset(freq, 0, sizeof freq);
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <vector>
+++ |+#include <cstring>
4 | #define vi vector<int>
|
s897536544 | p03667 | C++ | #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl
using namespace std;
typedef pair<int,int>P;
const int MAX_N = 205;
int main()
{
int n,m;
cin >> n >> m;
vector<int> a(n);
rep(i,n){
cin >> a[i];
}
rep(i,m){
int x,y;
cin >> x >> y;
vector<int> c(n+1,0);
a[x-1] = y;
rep(j,n){
c[a[j]]++;
}
int inc = 0;
int dec = 0;
int ans = 0;
for(int j=n;j>=1;j--){
if(c[j] == 0){
if(dec > 0){
dec--;
}else{
inc++;
ans++;
}
}else if(c[j] == 1){
c[j]--;
}else{
// if(i == 3 && j == 1){
// show(diff);
// }
rep(i,c[j]-1){
if(j-i-1 < 1){
break;
}
if(c[j-i-1] > 0){
if(inc >= c[j-i-1]){
inc -= c[j-i-1];
}else{
dec = c[j-i-1] - inc;
inc = 0:
ans += dec;
}
}
}
j -= c[j]-1;
}
}
cout << ans << "\n";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:66:36: error: expected ';' before ':' token
66 | inc = 0:
| ^
| ;
|
s106199974 | p03667 | C++ | #include <bits/stdc++.h>
#define MaxN 200005
#define INF 2140000000
#define eps 1e-9
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795
using namespace std;
int N,M,fr[MaxN],v[MaxN],P,X;
int main()
{
cin>>N>>M;
if(N>300)
return 0;
for(int i=1;i<=N;i++)
cin>>v[i],fr[v[i]]++;
fr[0]=1;
for(int i=1;i<=M;i++)
{
cin>>P>>X;
fr[v[P]]--;
fr[X]++;
v[P]=X;
int Poz=0,Neg=0,pos1=N,pos2=N-1;
while(fr[pos1]==0)
pos1--;
pos2=pos1-1;
while(pos2>=0)
{
if(fr[pos2]==0)
pos2--;
else
{
if(pos1-pos2>fr[pos1])
Neg+=pos1-pos2-fr[pos1];
else Poz+=fr[pos1]-pos1+pos2;
pos1=pos2;
pos2--;
}
}
cout<<max(Poz+Neg)<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:44:18: error: no matching function for call to 'max(int)'
44 | cout<<max(Poz+Neg)<<endl;
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed:
a.cc:44:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
44 | cout<<max(Poz+Neg)<<endl;
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
|
s873701711 | p03668 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;
vector<vector<ll>> adj;
int dfs(int n=0, int p=-1) {
int result = 0;
for (auto x: adj[n]) {
if (x==p) continue;
result ^= dfs(x,n);
}
if (p!=-1) result++;
cout << n << " " << p << " " << result << endl;
return result;
}
int main() {
int N; cin >> N;
adj.resize(N);
rep(i,N-1) {
// ll x, y; cin >> x >> y; x--; y--;
adj[x].push_back(y);
adj[y].push_back(x);
}
string result = dfs() ? "Alice" : "Bob";
cout << result << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:28:9: error: 'x' was not declared in this scope
28 | adj[x].push_back(y);
| ^
a.cc:28:22: error: 'y' was not declared in this scope
28 | adj[x].push_back(y);
| ^
|
s553531657 | p03668 | Java | import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
int n = sc.nextInt();
n--;
int a[][] = new int[2][n];
for(int i = 0;i < n;i++){
for(int j = 0;j < 2;j++){
a[j][i] = sc.nextInt();
}
}
sc.close();
int counter = 0;
int counter_ = 0;
for(int j = 0;j < n;j++){
if(a[0][j] == 1 || a[1][j]==1){counter++;}
else {counter_++;}
}
if(counter == 1){System.out.println("Alice");}
else if ((counter % 2 == 1 && counter_ % 2 == 0)||(counter % 2 == 0 && counter_ % 2 == 1)){System.out.println("Alice");}
else {System.out.println("Bob");}
}
} | Main.java:2: error: class Program is public, should be declared in a file named Program.java
public class Program
^
1 error
|
s490619060 | p03668 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
using ll = long long;
using namespace std;
vector<int> G[100010];
int childs[100010]={0}, par[100010];
int grundy(int i=0) {
int ans = 0;
for (auto g:G[i]) {
if (childs[g]) continue;
childs[i]++;
par[g] = i;
if (i > 0) ans += grundy(g);
else ans ^= grundy(g);
}
if (i > 0) {
if (child[i] > 1) ans = 0;
ans++;
}
return ans;
}
int main() {
int n;
cin >> n;
for (int i=1, x, y; i<n; i++) {
cin >> x >> y;
x--; y--;
G[x].push_back(y);
G[y].push_back(x);
}
cout << (grundy() ? "Alice" : "Bob") << '\n';
return 0;
}
| a.cc: In function 'int grundy(int)':
a.cc:24:13: error: 'child' was not declared in this scope; did you mean 'childs'?
24 | if (child[i] > 1) ans = 0;
| ^~~~~
| childs
|
s754938235 | p03668 | C++ | #include <bits/stdc++.h>
using namespace std;
const int N=1000010
vector<int> e[N];
int n,sg[N],u,v;
void dfs(int u,int fa)
{
sg[u]=0;
for(auto v : e[u])
{
if(v==fa)continue;
dfs(v,u);
sg[u]^=sg[v]+1;
}
}
int main()
{
cin>>n;
for(int i=1;i<n;++i)
{
cin>>u>>v;
e[u].push_back(v);
e[v].push_back(u);
}
dfs(1,0);
puts(sg[1]?"Alice":"Bob");
} | a.cc:6:1: error: expected ',' or ';' before 'vector'
6 | vector<int> e[N];
| ^~~~~~
a.cc: In function 'void dfs(int, int)':
a.cc:12:18: error: 'e' was not declared in this scope
12 | for(auto v : e[u])
| ^
a.cc: In function 'int main()':
a.cc:26:9: error: 'e' was not declared in this scope
26 | e[u].push_back(v);
| ^
|
s036197848 | p03668 | C++ | // luogu-judger-enable-o2
| /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s551049165 | p03668 | C++ | //Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define orz 1000000007
using namespace std;
int n,a[100005];
vector<int> v[100005];
void dfs(int x,int y){
for(int i=0;i<v[x].size();++i){
int z=v[x][i];
if(y==z) continue;
dfs(z,x);
a[x]^=(a[z]+1);
}
if(cnt==1)++a[x];
}
int main(){
scanf("%d",&n);
for(int i=1;i<n;++i){
int x,y;
scanf("%d%d",&x,&y);
v[x].pb(y),v[y].pb(x);
}
dfs(1,0);
if(a[1])puts("Alice");
else puts("Bob");
//system("pause");
return 0;
}
| a.cc: In function 'void dfs(int, int)':
a.cc:75:8: error: 'cnt' was not declared in this scope; did you mean 'int'?
75 | if(cnt==1)++a[x];
| ^~~
| int
|
s774238297 | p03668 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
vector<vec>G(N);
int dfs(int x,int p){
int g=0;
for(auto e:G[x]){
if(e!=p){
g^=(dfs(e,x)+1);}
}
}
main(){
int n=in();
rep(i,n-1){
int a=in(),b=in();
G[a].pb(b);
G[b].pb(a);}
cout<<((dfs(1,0)!=0)?“Alice”:“Bob”);
}
| a.cc:66:24: error: extended character “ is not valid in an identifier
66 | cout<<((dfs(1,0)!=0)?“Alice”:“Bob”);
| ^
a.cc:66:24: error: extended character ” is not valid in an identifier
a.cc:66:32: error: extended character “ is not valid in an identifier
66 | cout<<((dfs(1,0)!=0)?“Alice”:“Bob”);
| ^
a.cc:66:32: error: extended character ” is not valid in an identifier
a.cc: In function 'int dfs(int, int)':
a.cc:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
59 | }
| ^
a.cc: At global scope:
a.cc:60:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
60 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:66:24: error: '\U0000201cAlice\U0000201d' was not declared in this scope
66 | cout<<((dfs(1,0)!=0)?“Alice”:“Bob”);
| ^~~~~~~
a.cc:66:32: error: '\U0000201cBob\U0000201d' was not declared in this scope
66 | cout<<((dfs(1,0)!=0)?“Alice”:“Bob”);
| ^~~~~
|
s268863220 | p03668 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
vector<vec>G(N);
int dfs(int x,int p){
int g=0;
for(auto e:G[x]){
if(e!=p){
g^=(dfs(e,x)+1);}
}
}
main(){
int n=in();
rep(i,n-1){
int a=in(),b=in();
G[a].pb(b);
G[b].pb(a);}
cout<<(dfs(1,0)?“Alice”:“Bob”);
}
| a.cc:66:19: error: extended character “ is not valid in an identifier
66 | cout<<(dfs(1,0)?“Alice”:“Bob”);
| ^
a.cc:66:19: error: extended character ” is not valid in an identifier
a.cc:66:27: error: extended character “ is not valid in an identifier
66 | cout<<(dfs(1,0)?“Alice”:“Bob”);
| ^
a.cc:66:27: error: extended character ” is not valid in an identifier
a.cc: In function 'int dfs(int, int)':
a.cc:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
59 | }
| ^
a.cc: At global scope:
a.cc:60:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
60 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:66:19: error: '\U0000201cAlice\U0000201d' was not declared in this scope
66 | cout<<(dfs(1,0)?“Alice”:“Bob”);
| ^~~~~~~
a.cc:66:27: error: '\U0000201cBob\U0000201d' was not declared in this scope
66 | cout<<(dfs(1,0)?“Alice”:“Bob”);
| ^~~~~
|
s015649269 | p03668 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
vector<vec>G(N);
int dfs(int x,int p){
int g=0;
for(auto e:G[x]){
if(e!=p){
g^=(dfs(e,x)+1);}
}
}
main(){
int n=in();
rep(i,n-1){
int a=in(),b=in();
G[a].pb(b);
G[b].pb(a);}
cout<<(dfs(1)?“Alice”:“Bob”);
}
| a.cc:66:17: error: extended character “ is not valid in an identifier
66 | cout<<(dfs(1)?“Alice”:“Bob”);
| ^
a.cc:66:17: error: extended character ” is not valid in an identifier
a.cc:66:25: error: extended character “ is not valid in an identifier
66 | cout<<(dfs(1)?“Alice”:“Bob”);
| ^
a.cc:66:25: error: extended character ” is not valid in an identifier
a.cc: In function 'int dfs(int, int)':
a.cc:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
59 | }
| ^
a.cc: At global scope:
a.cc:60:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
60 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:66:13: error: too few arguments to function 'int dfs(int, int)'
66 | cout<<(dfs(1)?“Alice”:“Bob”);
| ~~~^~~
a.cc:53:5: note: declared here
53 | int dfs(int x,int p){
| ^~~
a.cc:66:17: error: '\U0000201cAlice\U0000201d' was not declared in this scope
66 | cout<<(dfs(1)?“Alice”:“Bob”);
| ^~~~~~~
a.cc:66:25: error: '\U0000201cBob\U0000201d' was not declared in this scope
66 | cout<<(dfs(1)?“Alice”:“Bob”);
| ^~~~~
|
s118877476 | p03668 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<int> edge[1000010];
int n,poi[1000010],u,v;
void dfs(int u,int fa)
{
poi[u]=0;
for(auto v : edge[u])
{
if(v==fa) continue;
dfs(v,u);
sg[u]^=sg[v]+1;
}
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n-1;++i)
{
scanf("%d%d",&u,&v);
edge[u].push_back(v);
edge[v].push_back(u);
}
dfs(1,0);
puts(poi[1]?"Alice":"Bob");
} | a.cc: In function 'void dfs(int, int)':
a.cc:14:9: error: 'sg' was not declared in this scope
14 | sg[u]^=sg[v]+1;
| ^~
|
s966313476 | p03668 | C++ | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
inline int getint()
{
static char c;
while ((c = getchar()) < '0' || c > '9');
int res = c - '0';
while ((c = getchar()) >= '0' && c <= '9')
res = res * 10 + c - '0';
return res;
}
const int MaxN = 100000;
int n;
vector<int> adj[MaxN + 1];
int dfs(int u, int fa)
{
int w = 0;
for (int v : adj[u])
if (v != fa)
w ^= dfs(v, u) + 1;
return w;
}
int main()
{
cin >> n;
for (int i = 1; i < n; ++i)
{
int u = getint(), v = getint();
adj[u].push_back(v);
adj[v].push_back(u);
}
cout << (dfs(1, 0) ? "Alice" : "Bob");
cout << endl;
return 0;
} | a.cc:22:1: error: 'vector' does not name a type
22 | vector<int> adj[MaxN + 1];
| ^~~~~~
a.cc: In function 'int dfs(int, int)':
a.cc:27:22: error: 'adj' was not declared in this scope
27 | for (int v : adj[u])
| ^~~
a.cc: In function 'int main()':
a.cc:39:17: error: 'adj' was not declared in this scope
39 | adj[u].push_back(v);
| ^~~
|
s763663497 | p03668 | C++ | //作者:中国江苏省南京市李硕睿
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
const int =1e5+7;
vector<int> adj[N];
int mark[N];
int nim[N];
void dfs(int v,int p){
for (auto u:adj[v])
if (u!=p){
dfs(u,v);
nim[v]^=nim[u]+1;
}
}
int main(){
ios::sync_with_stdio(false);
int n;
cin>>n;
for (int i=1;i<n;i++){
int u,v;
cin>>u>>v;
u--;
v--;
adj[v].push_back(u);
adj[u].push_back(v);
}
dfs(0,-1);
cout<<(nim[0] ? "Alice" : "Bob")<<"\n";
return 0;
} | a.cc:59:11: error: expected unqualified-id before '=' token
59 | const int =1e5+7;
| ^
a.cc:60:17: error: 'N' was not declared in this scope
60 | vector<int> adj[N];
| ^
a.cc:61:10: error: 'N' was not declared in this scope
61 | int mark[N];
| ^
a.cc:62:9: error: 'N' was not declared in this scope
62 | int nim[N];
| ^
a.cc: In function 'void dfs(int, int)':
a.cc:64:21: error: 'adj' was not declared in this scope
64 | for (auto u:adj[v])
| ^~~
a.cc:67:25: error: 'nim' was not declared in this scope
67 | nim[v]^=nim[u]+1;
| ^~~
a.cc: In function 'int main()':
a.cc:79:17: error: 'adj' was not declared in this scope
79 | adj[v].push_back(u);
| ^~~
a.cc:83:16: error: 'nim' was not declared in this scope
83 | cout<<(nim[0] ? "Alice" : "Bob")<<"\n";
| ^~~
|
s113027754 | p03668 | Java | import java.util.*;
public class Main {
static ArrayList[] edge;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
edge = new ArrayList[N + 1];
for(int i = 1; i < N + 1; i++) {
edge[i] = new ArrayList<Integer>();
}
for(int i = 0; i < N - 1; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
edge[x].add(y);
edge[y].add(x);
}
String ans = "Alice";
if(dfs(1, 0) == 0) ans = "Bob";
System.out.println(ans);
}
public static int dfs(int v, int p) {
ArrayList<Integer> list = edge[v];
int ret = 0;
for(int i = 0; i < list.size(); i++) {
int u = list.get(i);
if(u != p) {
ret = (ret ^ (dfs(u, v) + 1));
}
}
}
} | Main.java:33: error: missing return statement
}
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s730260209 | p03668 | C++ | #include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
int n;
#define MAX 100002
vector<int> v[MAX];
int gr[MAX];
inline void dfs(int b,int pr=-1) {
if (v[b].size() == 1 ) {
gr[b] = 0;
return;
}
for (int i = 0; i < v[b].size(); i++) {
int go = v[b][i];
if (go != pr) {
dfs(go,b);
gr[b] ^= (gr[go] + 1);
}
}
}
int main() {
cin >> n;
for (int i = 1; i < n; i++) {
int a, b;
scanf("%d%d", &a, &b);
a--;
b--;
v[a].push_back(b);
v[b].push_back(a);
}
dfs(0);
if (gr[0]) {
puts("Alice");
}
else {
puts("Bob");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:33:9: error: 'cin' was not declared in this scope
33 | cin >> n;
| ^~~
a.cc:8:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
7 | #include<cmath>
+++ |+#include <iostream>
8 | using namespace std;
a.cc:36:17: error: 'scanf' was not declared in this scope
36 | scanf("%d%d", &a, &b);
| ^~~~~
a.cc:44:17: error: 'puts' was not declared in this scope
44 | puts("Alice");
| ^~~~
a.cc:47:17: error: 'puts' was not declared in this scope
47 | puts("Bob");
| ^~~~
|
s060485619 | p03668 | C++ | #include<bits/stdc++.h>
using namespace std;
const int MAX = 1234567;
vector<int> g[MAX];
int dfs (int v, int r) {
int res = 0;
for (auto u : g[v])
if (u != r)
res ^= dfs (u, v);
return res + 1;
}
int main() {
ios_base :: sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 0; i < n-1; i++) {
int a, b;
cin >> a >> b; a--; b--;
g[a].push_back(b);
g[b].push_back(a);
}
cout << (dfs (0,-1)==1 ? "Bob" : "Alice") << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:16: error: 'n' was not declared in this scope; did you mean 'yn'?
20 | cin >> n;
| ^
| yn
|
s438284662 | p03668 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,x[100010];
int main(){
cin>>n;
memset(x,0,n);
for(int i=0;i<n;i++){
int a,b;cin>>a>>b;a--,b--;
x[a]++,x[b]++;
}
int cnt=0;
for(int i=0;i<n;i++){
if(x[i]%2==1)cnt++;
}
if(cnt%2==1)cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
10 | memset(x,0,n);
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<vector>
+++ |+#include <cstring>
5 | #define rep(i,n) for(int i=0;i<n;i++)
|
s237659871 | p03668 | C++ | #include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
const int M=100005;
bool has[M];
int n,fa[M],sg[M],res;
vector<int>G[M];
int Tz(int x=1,int f=-1){
int res=sg[x];
For(i,0,G[x].size())if(G[x][i]!=f)
res^=(Tz(G[x][i],x)+1);
return res;
}
int main(){
scanf("%d",&n);
For(i,0,n-1){
int x,y;
scanf("%d %d",&x,&y);
G[x-1].push_back(y-1);
G[y-1].push_back(x-1);
}
For(i,0,n)dfs(i);
printf("%s",Tz()?"Alice":"Bob");
return 0;
} | a.cc: In function 'int main()':
a.cc:22:19: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
22 | For(i,0,n)dfs(i);
| ^~~
| ffs
|
s510152669 | p03668 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,x[100010];
int main(){
cin>>n;
memset(x,0,n);
for(int i=0;i<n;i++){
int a,b;a--,b--;
x[a]++,x[b]++;
}
int cnt=0;
for(int i=0;i<n;i++){
if(x[i]%2==1)cnt++;
}i
if(cnt%2==1)cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
10 | memset(x,0,n);
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<vector>
+++ |+#include <cstring>
5 | #define rep(i,n) for(int i=0;i<n;i++)
a.cc:18:10: error: 'i' was not declared in this scope
18 | }i
| ^
a.cc:20:9: error: 'else' without a previous 'if'
20 | else cout<<"Bob"<<endl;
| ^~~~
|
s011614043 | p03668 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
int N;
vector<vector<int > > to;
int dfs(int i,int from) {
if (to[i].size() == 1) {
return 1;
}
else {
int ret = 0;
for (int j = 0; j < to[i].size(); j++) {
if (to[i][j] != from) {
ret += dfs(to[i][j], i);
}
}
}
return ret % 2;
}
signed main() {
cin >> N;
to.resize(N);
int x, y;
for (int i = 0; i < N - 1; i++) {
cin >> x >> y;
x--;
y--;
to[x].push_back(y);
to[y].push_back(x);
}
int res;
res = dfs(0,-1);
if (res == 1) {
cout << "Alice" << endl;
}
else {
cout << "Bob" << endl;
}
return 0;
} | a.cc: In function 'int dfs(int, int)':
a.cc:18:16: error: 'ret' was not declared in this scope
18 | return ret % 2;
| ^~~
|
s038811646 | p03668 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T> using Graph = vector<vector<T>>;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (__typeof(a.begin()) x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define endl '\n'
int N;
set<int> cand;
int x[100005], y[100005];
int main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N;
int root = 0;
int edge = 0;
rep(i, N - 1) {
cin >> x[i] >> y[i];
x[i]--; y[i]--;
if (x[i] > y[i]) swap(x[i], y[i]);
if (x[i] == 0) {
root += 1;
cand.add(y[i]);
}
}
rep(i, N) {
if (HAS(cand, x[i])) {
edge += 1;
root -= 1;
cand.remove(x[i]);
}
if (HAS(cand, y[i])) {
edge += 1;
root -= 1;
cand.remove(y[i]);
}
}
int hand = 0;
while (true) {
if (edge == 0) {
root -= 1;
}
else {
if (root%2 == 1) {
edge -= 1;
} else {
root -= 1;
}
}
if (root == 0) {
cout << (hand == 1 ? "Bob":"Alice") << endl;
break;
}
hand = (hand + 1)%2;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:33:16: error: 'class std::set<int>' has no member named 'add'
33 | cand.add(y[i]);
| ^~~
a.cc:41:14: error: 'class std::set<int>' has no member named 'remove'
41 | cand.remove(x[i]);
| ^~~~~~
a.cc:46:14: error: 'class std::set<int>' has no member named 'remove'
46 | cand.remove(y[i]);
| ^~~~~~
|
s433043901 | p03668 | C++ | #include <iostream>
#include <cstdio>
using anemspace std;
int main()
{
char c;
while(scanf("%c",&c)!=EOF);
printf("Alice");
} | a.cc:3:7: error: expected nested-name-specifier before 'anemspace'
3 | using anemspace std;
| ^~~~~~~~~
|
s600440775 | p03668 | C++ | //Copyright(c)2017 Mstdream
#include<bits/stdc++.h>
using namespace std;
inline void splay(int &v){
v=0;char c=0;int p=1;
while(c<'0' || c>'9'){if(c=='-')p=-1;c=getchar();}
while(c>='0' && c<='9'){v=(v<<3)+(v<<1)+c-'0';c=getchar();}
v*=p;
}
const int N=200020;
int nxt[N*2],fir[N],to[N*2],sz,n,dp[N];
void add(int x,int y){
nxt[++sz]=fir[x],fir[x]=sz,to[sz]=y;
}
//1先手0后手
void dfs(int x,int fa){
int a=0,b=0;
for(int u=fir[x];u;u=nxt[u]){
if(to[u]!=fa){
dfs(to[u],x);
if(dp[to[u]]==1)a++;
else b++;
}
}
if((b&1)==1)dp[x]=1;
else{
if((a&1)==1)dp[x]=1;
else dp[x]=0;
}
}
int main(){
int _q=20<<20;
char *_p=(char*)malloc(_q)+_q;
__asm__("movl %0, %%esp\n"::"r"(_p));
splay(n);
for(int i=1;i<n;i++){
int x,y;splay(x),splay(y);
add(x,y),add(y,x);
}
dfs(1,0);
puts(dp[1]?"Alice":"Bob");
} | a.cc: Assembler messages:
a.cc:34: Error: operand type mismatch for `mov'
|
s294941022 | p03668 | C++ | #include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#define ll long long
#define INF 1000000000
#define clr(x) memset(x,0,sizeof(x))
using namespace std;
inline int read()
{
register int ret=0,c=getchar();
while(!isdigit(c))c=getchar();
while(isdigit(c))ret=ret*10+c-'0',c=getchar();
return ret;
}
#define M 100005
int n,fa[M],sg[M];
int first[M],next[M<<1],to[M<<1],t;
void addedge(int s,int v)
{
next[++t]=first[s];
first[s]=t;
to[t]=v;
}
void dfs(int x)
{
for(int i=first[x];i;i=next[i])
{
int v=to[i];
if(v==fa[x])continue;
fa[v]=x;
dfs(v);
sg[x]^=sg[v]+1;
}
}
int main()
{
n=read();
for(int i=1;i<n;i++)
{
int x=read(),y=read();
addedge(x,y);
addedge(y,x);
}
dfs(1);
if(sg[1]==0)puts("Bob");
else puts("Alice");
return 0;
} | a.cc: In function 'int read()':
a.cc:12:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
12 | register int ret=0,c=getchar();
| ^~~
a.cc:12:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
12 | register int ret=0,c=getchar();
| ^
a.cc: In function 'void addedge(int, int)':
a.cc:25:9: error: reference to 'next' is ambiguous
25 | next[++t]=first[s];
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from a.cc:4:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:21:14: note: 'int next [200010]'
21 | int first[M],next[M<<1],to[M<<1],t;
| ^~~~
a.cc: In function 'void dfs(int)':
a.cc:32:32: error: reference to 'next' is ambiguous
32 | for(int i=first[x];i;i=next[i])
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:21:14: note: 'int next [200010]'
21 | int first[M],next[M<<1],to[M<<1],t;
| ^~~~
|
s183574642 | p03668 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<cmath>
using namespace std;
typedef long long LL;
const int N=500050;
int head[N],to[N],next[N],sg[N],n,tot;
void addedge(int u,int v){
tot++;to[tot]=v,next[tot]=head[u],head[u]=tot;
tot++;to[tot]=u,next[tot]=head[v],head[v]=tot;
}
void dfs(int x,int fa){
for(int i=head[x];i;i=next[i]){
if(to[i]!=fa){
dfs(to[i],x);
sg[x]^=sg[to[i]]+1;
}
}
}
int main(){
int i,j,k;
scanf("%d",&n);
for(i=1;i<n;i++){
scanf("%d%d",&j,&k);
addedge(j,k);
}
dfs(1,0);
if(sg[1])puts("Alice");
else puts("Bob");
return 0;
}
| a.cc: In function 'void addedge(int, int)':
a.cc:16:25: error: reference to 'next' is ambiguous
16 | tot++;to[tot]=v,next[tot]=head[u],head[u]=tot;
| ^~~~
In file included from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:19: note: 'int next [500050]'
13 | int head[N],to[N],next[N],sg[N],n,tot;
| ^~~~
a.cc:17:25: error: reference to 'next' is ambiguous
17 | tot++;to[tot]=u,next[tot]=head[v],head[v]=tot;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:19: note: 'int next [500050]'
13 | int head[N],to[N],next[N],sg[N],n,tot;
| ^~~~
a.cc: In function 'void dfs(int, int)':
a.cc:20:31: error: reference to 'next' is ambiguous
20 | for(int i=head[x];i;i=next[i]){
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:19: note: 'int next [500050]'
13 | int head[N],to[N],next[N],sg[N],n,tot;
| ^~~~
|
s397929080 | p03668 | C++ | #include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef long long LL;
const int maxn=1e5+5;
int n;
int tot,go[2*maxn],next[2*maxn],f1[maxn];
void ins(int x,int y)
{
go[++tot]=y;
next[tot]=f1[x];
f1[x]=tot;
}
int sg[maxn];
void dfs(int k,int last)
{
sg[k]=0;
for(int p=f1[k]; p; p=next[p]) if (go[p]!=last)
{
dfs(go[p],k);
sg[k]^=(sg[go[p]]+1);
}
}
int main()
{
scanf("%d",&n);
fo(i,1,n-1)
{
int x,y;
scanf("%d %d",&x,&y);
ins(x,y), ins(y,x);
}
dfs(1,0);
printf((sg[1]) ?"Alice\n" :"Bob\n");
} | a.cc: In function 'void ins(int, int)':
a.cc:16:9: error: reference to 'next' is ambiguous
16 | next[tot]=f1[x];
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:12:20: note: 'int next [200010]'
12 | int tot,go[2*maxn],next[2*maxn],f1[maxn];
| ^~~~
a.cc: In function 'void dfs(int, int)':
a.cc:24:31: error: reference to 'next' is ambiguous
24 | for(int p=f1[k]; p; p=next[p]) if (go[p]!=last)
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:12:20: note: 'int next [200010]'
12 | int tot,go[2*maxn],next[2*maxn],f1[maxn];
| ^~~~
|
s213355724 | p03668 | C++ | 5
1 2
2 3
1 4
4 5 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 5
| ^
|
s773625872 | p03668 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
const int N=100010;
int e[N*2],next[N*2],head[N],ed=0;
void adde(int x,int y){e[++ed]=y;next[ed]=head[x];head[x]=ed;}
int dfs(int x,int fa){
int i,t=0;
for(i=head[x];i;i=next[i])
if(e[i]!=fa) t^=dfs(e[i],x)+1;
return t;
}
int main(){
int n,i,x,y;
scanf("%d",&n);
for(i=1;i<n;i++){
scanf("%d %d",&x,&y);
adde(x,y);adde(y,x);
}
if(dfs(1,0)) printf("Alice\n");
else printf("Bob\n");
return 0;
}
| a.cc: In function 'void adde(int, int)':
a.cc:11:34: error: reference to 'next' is ambiguous
11 | void adde(int x,int y){e[++ed]=y;next[ed]=head[x];head[x]=ed;}
| ^~~~
In file included from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:10:12: note: 'int next [200020]'
10 | int e[N*2],next[N*2],head[N],ed=0;
| ^~~~
a.cc: In function 'int dfs(int, int)':
a.cc:14:23: error: reference to 'next' is ambiguous
14 | for(i=head[x];i;i=next[i])
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:10:12: note: 'int next [200020]'
10 | int e[N*2],next[N*2],head[N],ed=0;
| ^~~~
|
s771778642 | p03668 | C++ | #include <vector>
static const int MAXN = 100005;
int n;
std::vector<int> e[MAXN];
int f[MAXN];
void dfs(int u, int p = -1)
{
f[u] = 0;
for (int v : e[u]) if (v != p) {
dfs(v, u);
f[u] ^= (f[v] + 1);
}
}
int main()
{
scanf("%d", &n);
for (int i = 0, u, v; i < n - 1; ++i) {
scanf("%d%d", &u, &v); --u, --v;
e[u].push_back(v);
e[v].push_back(u);
}
dfs(0);
puts(f[0] == 0 ? "Bob" : "Alice");
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:5: error: 'scanf' was not declared in this scope
20 | scanf("%d", &n);
| ^~~~~
a.cc:28:5: error: 'puts' was not declared in this scope
28 | puts(f[0] == 0 ? "Bob" : "Alice");
| ^~~~
|
s387350573 | p03669 | C++ | #include<bits/stdc++.h>
using namespace std;
const int N=410;
int n,h,in[N],out[N];
int fa[N];
bool ok[N];
int find(const int &x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int main(){
n=read();h=read();
for(int i=1;i<=(h<<1);i++) fa[i]=i;
for(int i=1;i<=n;i++){
int A=read(),B=read(),C=read(),D=read();
int x=C?C+h:A,y=D?D:B+h;
out[x]++;in[y]++;
x=find(x);y=find(y);
if(x!=y) fa[x]=y;
}
for(int i=1;i<=h;i++) if(in[i]>out[i]) return !puts("NO");
for(int i=h+1;i<=(h<<1);i++) if(in[i]<out[i]) return !puts("NO");
for(int i=1;i<=(h<<1);i++) if(in[i]!=out[i]||!in[i]&&!out[i]) ok[find(i)]=1;
for(int i=1;i<=(h<<1);i++) if(fa[i]==i&&!ok[i]) return !puts("NO");
return !puts("YES");
} | a.cc: In function 'int main()':
a.cc:9:11: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
9 | n=read();h=read();
| ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /usr/include/c++/14/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
a.cc:9:20: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
9 | n=read();h=read();
| ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
a.cc:12:19: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
12 | int A=read(),B=read(),C=read(),D=read();
| ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
| ^~~~
a.cc:13:15: error: 'C' was not declared in this scope
13 | int x=C?C+h:A,y=D?D:B+h;
| ^
a.cc:14:21: error: 'y' was not declared in this scope
14 | out[x]++;in[y]++;
| ^
|
s941292504 | p03669 | C++ | #include <iostream>
#include <vector>
#include<string.h>
using namespace std;
struct node
{
int a, b, c, d;
};
vector<int> v[2][200];
node nd[100010];
bool rcd[100010];
int count = 1;
int N, H;
bool dfs(int f, int h)
{
for (int i = 0; i < v[f][h].size(); i++)
{
if (rcd[v[f][h][i]] == 1)
continue;
else
rcd[v[f][h][i]] == 1;
if (++count == N)
return 1;
node nt = nd[v[f][h][i]];
int f1, h1;
if (nt.d == 0)
{
f1 = 1;
h1 = nt.b;
}
else
{
f1 = 0;
h1 = nt.d;
}
if (dfs(f1, h1))
return 1;
else
rcd[v[f][h][i]] = 0;
}
}
int main()
{
cin >> N >> H;
for (int i = 0; i < N; i++)
{
int A, B, C, D;
cin >> A >> B >> C >> D;
nd[i].a = A;
nd[i].b = B;
nd[i].c = C;
nd[i].d = D;
if (nd[i].c == 0)
{
v[0][nd[i].a].push_back(i);
}
else
v[1][nd[i].c].push_back(i);
}
for (int i = 0; i < N; i++)
{
memset(rcd,0,sizeof(rcd));
if (nd[i].c == 0)
{
rcd[i]=1;
if (dfs(nd[i].d == 0 ? 1 : 0, nd[i].d == 0 ? nd[i].b : nd[i].d))
{
cout << "YES";
return 0;
}
}
count=1;
cout << "NO";
return 0;
} | a.cc: In function 'int main()':
a.cc:78:2: error: expected '}' at end of input
78 | }
| ^
a.cc:45:1: note: to match this '{'
45 | {
| ^
a.cc: In function 'bool dfs(int, int)':
a.cc:42:1: warning: control reaches end of non-void function [-Wreturn-type]
42 | }
| ^
|
s832193581 | p03669 | C++ | //AtCoder Grand Contest 017 E - Jigsaw
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
int qr(){int ret = 0,f=1;char ch =getchar();while(!isdigit(ch))f=ch=='-'?-1:1,ch=getchar();while(isdigit(ch))ret=ret*10+ch-'0',ch=getchar();return ret*f;}
#define maxN 100005
#define maxH 205
int indegree[maxH<<2],outdegree[maxH<<2];
void read(int x,int y){
indegree[y]++;
outdegree[x]++;
nxt[++tot] = fir[x];
fir[x] = tot;
ver[tot] = y;
}
int f[maxH<<1];
void init(){
for(int i = 1;i<=(maxH<<1);i++)
f[i] = i;
}
int gf(int x){
if(f[x] == x) return x;
else return f[x] = gf(f[x]);
}
int mer(int x,int y){
x = gf(x);y = gf(y);
if(x == y) return 0;
f[x] = y;
return 1;
}
int main(){
int N = qr(),H = qr();
int NN = N;
int t1,t2,t3,t4,t5,t6;//上 t + maxN 下 t + maxN + maxH
for(int i = 1;i<=N;i++){
t1 = qr(),t2 = qr(),t3 = qr(),t4 = qr();
if(!t3) t5 = t1;else t5 = t3+H;
if(!t4) t6 = t2+H;else t6 = t4;
read(t5,t6);
N -= mer(t5,t6);
}
if(NN != 1){
cout << "NO";
return 0;
}
int in = 0,out = 0;
for(int i = 1;i<=(H<<1);i++){
if(indegree[i]!=outdegree[i]){
if(indegree[i]>outdegree[i])
in++;
else out++;
if(in == 2||out == 2){
cout <<"NO";
return 0;
}
}
}
cout << "YES";
/*
int a=0,b=0;
for(int i = maxN;i<=maxN + 500;i++){
if(indegree[i] == outdegree[i])
continue;
else {
if(abs(indegree[i]-outdegree[i])!=1) {cout << "NO";return 0;}
else {
//if(i<=maxN+maxH) {
if(indegree[i] > outdegree[i])
a++;
else b++;
//}else{
// if(indegree[i] > outdegree[i])
// b++;
// else a++;
//}
}
if(a == 2||b == 2){cout << "NO";return 0;}
}
}
if(a == b){cout << "YES";}
else {cout << "NO";}
*/
return 0;
}
| a.cc: In function 'void read(int, int)':
a.cc:19:5: error: 'nxt' was not declared in this scope
19 | nxt[++tot] = fir[x];
| ^~~
a.cc:19:11: error: 'tot' was not declared in this scope
19 | nxt[++tot] = fir[x];
| ^~~
a.cc:19:18: error: 'fir' was not declared in this scope
19 | nxt[++tot] = fir[x];
| ^~~
a.cc:21:5: error: 'ver' was not declared in this scope
21 | ver[tot] = y;
| ^~~
|
s764102524 | p03669 | C++ | //AtCoder Grand Contest 017 E - Jigsaw
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
int qr(){int ret = 0,f=1;char ch =getchar();while(!isdigit(ch))f=ch=='-'?-1:1,ch=getchar();while(isdigit(ch))ret=ret*10+ch-'0',ch=getchar();return ret*f;}
#define maxN 100005
#define maxH 205
int fir[maxN],nxt[maxN<<3],ver[maxN<<3],tot;
int indegree[maxN<<2],outdegree[maxN<<2];
void read(int x,int y){
indegree[y]++;
outdegree[x]++;
nxt[++tot] = fir[x];
fir[x] = tot;
ver[tot] = y;
}
int f[maxH<<1];
void init(){
for(int i = 1;i<=(maxH<<1);i++)
f[i] = i;
}
int gf(int x){
if(f[x] == x) return x;
else return f[x] = gf(f[x]);
}
int mer(int x,int y){
x = gf(x);y = gf(y);
if(x == y) return 0;
f[x] = y;
return 1;
}
int main(){
int N = qr(),H = qr();
int N = N;
int t1,t2,t3,t4,t5,t6;//上 t + maxN 下 t + maxN + maxH
for(int i = 1;i<=N;i++){
t1 = qr(),t2 = qr(),t3 = qr(),t4 = qr();
/*
if(t3 == 0) read(t1 + maxN + maxH , i);
else read(t3 + maxN , i);
if(t4 == 0) read(i,t2+maxN);
else read(i,t4 + maxN + maxH);*/
if(!t3) t5 = t1;else t5 = t3+H;
if(!t4) t6 = t2+H;else t6 = t4;
read(t5,t6);
N -= mer(t5,t6);
}
if(N != 1){
cout << "NO";
return 0;
}
int in = 0,out = 0;
for(int i = 1;i<=(H<<1);i++){
if(indegree[i]!=outdegree[i]){
if(indegree[i]>outdegree[i])
in++;
else out++;
if(in == 2||out == 2){
cout <<"NO";
return 0;
}
}
}
cout << "YES";
/*
int a=0,b=0;
for(int i = maxN;i<=maxN + 500;i++){
if(indegree[i] == outdegree[i])
continue;
else {
if(abs(indegree[i]-outdegree[i])!=1) {cout << "NO";return 0;}
else {
//if(i<=maxN+maxH) {
if(indegree[i] > outdegree[i])
a++;
else b++;
//}else{
// if(indegree[i] > outdegree[i])
// b++;
// else a++;
//}
}
if(a == 2||b == 2){cout << "NO";return 0;}
}
}
if(a == b){cout << "YES";}
else {cout << "NO";}
*/
return 0;
}
| a.cc: In function 'int main()':
a.cc:41:9: error: redeclaration of 'int N'
41 | int N = N;
| ^
a.cc:40:9: note: 'int N' previously declared here
40 | int N = qr(),H = qr();
| ^
|
s982545589 | p03669 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int MAXN = (200 + 10) * 2;
class no_solution : public std::exception
{
public:
const char * what(void) const noexcept
{
return "no solution reachable";
}
};
namespace disjointSet
{
int fa[MAXN];
void init()
{
memset(fa, 0x00, sizeof fa);
}
int find(int x)
{
if(fa[x])
return x;
return fa[x] = find(fa[x]);
}
void merge(int x, int y)
{
x = fa(x), y = fa(y);
if(x != y)
fa[x] = y;
}
}
bool loop[MAXN];
int inDeg[MAXN], outDeg[MAXN];
int N, H;
void solve()
{
for(int i = 0; i <= 2 * H; i++)
{
if(i > H)
if(inDeg[i] > outDeg[i])
throw no_solution();
if(i < H)
if(outDeg[i] > inDeg[i])
throw no_solution();
bool found = false, isLoop = loop[i];
for(int j = 0; j <= 2 * H; j++)
if(found)
break;
else
if(disjointSet::find(i) == disjointSet::find(j))
{
if(i != j)
isLoop = true;
if(inDeg[j] != outDeg[j])
found = true;
}
if(!found && isLoop)
throw no_solution();
}
}
int main()
{
ios::sync_with_stdio(false), cin.tie(nullptr);
cin >> N >> H ;
for(int i = 1; i <= N; i++)
{
int a, b, c, d, L, R;
cin >> a >> b >> c >> d;
L = c ? H - c : H + a;
R = d ? H + d : H - b;
disjointSet::merge(L, R);
inDeg[R]++, outDeg[L]++;
if(L == R)
loop[L] = true;
}
try
{
solve();
cout << "YES" << endl;
}
catch(std::exception & x)
{
cout << "NO" << endl ;
}
return 0;
}
| a.cc: In function 'void disjointSet::merge(int, int)':
a.cc:34:15: error: 'disjointSet::fa' cannot be used as a function
34 | x = fa(x), y = fa(y);
| ~~^~~
a.cc:34:26: error: 'disjointSet::fa' cannot be used as a function
34 | x = fa(x), y = fa(y);
| ~~^~~
|
s357648144 | p03669 | C++ | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
x=0;int f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
x*=f;
}
inline void judge(){
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=400005;
int fa[maxn],rd[maxn],n,h,m=400,active[maxn],get[maxn];
inline int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int main(){
read(n);read(h);
rep(i,1,m)fa[i]=i;
rep(i,1,n){
int a,b,c,d,p,q;read(a);read(b);read(c);read(d);
p=c?-c:a;
q=d?d:-b;
p+=200;q+=200;
// printf("%d %d\n",p,q);
rd[p]++;rd[q]--;
fa[find(p)]=find(q);
active[p]=active[q]=1;
}
rep(i,1,200)if(rd[i]>0){
puts("NO");return 0;
}
rep(i,200,m)if(rd[i]<0){
puts("NO");return 0;
}
rep(i,1,m)if(rd[i])get[find(i)]=1;
rep(i,1,m)if(i==find(i)&&active[i]&&!get[i]){
puts("NO");return 0;
}
puts("YES");
return 0;
}
| a.cc: In function 'int main()':
a.cc:53:28: error: reference to 'get' is ambiguous
53 | rep(i,1,m)if(rd[i])get[find(i)]=1;
| ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:1:
/usr/include/c++/14/variant:1180:5: note: candidates are: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const variant<_Types ...>&&)'
1180 | get(const variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/variant:1170:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const variant<_Types ...>&)'
1170 | get(const variant<_Types...>& __v)
| ^~~
/usr/include/c++/14/variant:1160:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(variant<_Types ...>&&)'
1160 | get(variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/variant:1150:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(variant<_Types ...>&)'
1150 | get(variant<_Types...>& __v)
| ^~~
/usr/include/c++/14/variant:1748:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(const variant<_Types ...>&&)'
1748 | get(const variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/variant:1737:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(const variant<_Types ...>&)'
1737 | get(const variant<_Types...>& __v)
| ^~~
/usr/include/c++/14/variant:1726:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >&& std::get(variant<_Types ...>&&)'
1726 | get(variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/variant:1715:5: note: 'template<long unsigned int _Np, class ... _Types> constexpr std::variant_alternative_t<_Np, std::variant<_Types ...> >& std::get(variant<_Types ...>&)'
1715 | get(variant<_Types...>& __v)
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/tuple:2517:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const tuple<_Elements ...>&&)'
2517 | get(const tuple<_Types...>&& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2505:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const tuple<_Elements ...>&)'
2505 | get(const tuple<_Types...>& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2494:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(tuple<_Elements ...>&&)'
2494 | get(tuple<_Types...>&& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2483:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(tuple<_Elements ...>&)'
2483 | get(tuple<_Types...>& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2476:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__enable_if_t<(__i >= sizeof... (_Types))> std::get(const tuple<_Elements ...>&)'
2476 | get(const tuple<_Elements...>&) = delete;
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1307:5: note: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_Up, _Tp>&&)'
1307 | get(const pair<_Up, _Tp>&& __p) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1302:5: note: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_Up, _Tp>&&)'
1302 | get(pair<_Up, _Tp>&& __p) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1297:5: note: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_Up, _Tp>&)'
1297 | get(const pair<_Up, _Tp>& __p) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1292:5: note: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_Up, _Tp>&)'
1292 | get(pair<_Up, _Tp>& __p) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1287:5: note: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_T1, _T2>&&)'
1287 | get(const pair<_Tp, _Up>&& __p) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1282:5: note: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_T1, _T2>&&)'
1282 | get(pair<_Tp, _Up>&& __p) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1277:5: note: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)'
1277 | get(const pair<_Tp, _Up>& __p) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1272:5: note: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)'
1272 | get(pair<_Tp, _Up>& __p) noexcept
| ^~~
In file included from /usr/include/c++/14/functional:65,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/array:417:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const array<_Tp, _Nm>&&)'
417 | get(const array<_Tp, _Nm>&& __arr) noexcept
| ^~~
/usr/include/c++/14/array:408:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const array<_Tp, _Nm>&)'
408 | get(const array<_Tp, _Nm>& __arr) noexcept
| ^~~
/usr/include/c++/14/array:399:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(array<_Tp, _Nm>&&)'
399 | get(array<_Tp, _Nm>&& __arr) noexcept
| ^~~
/usr/include/c++/14/array:390:5: note: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(array<_Tp, _Nm>&)'
390 | get(array<_Tp, _Nm>& __arr) noexcept
| ^~~
/usr/include/c++/14/tuple:2466:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&)'
2466 | get(const tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2457:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)'
2457 | get(tuple<_Elements...>&& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2451:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)'
2451 | get(const tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/14/tuple:2445:5: note: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)'
2445 | get(tuple<_Elements...>& __t) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1265:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)'
1265 | get(const pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1260:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)'
1260 | get(const pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1255:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)'
1255 | get(pair<_Tp1, _Tp2>&& __in) noexcept
| ^~~
/usr/include/c++/14/bits/stl_pair.h:1250:5: note: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)'
1250 | get(pair<_Tp1, _Tp2>& __in) noexcept
| ^~~
a.cc:32:46: note: 'int get [400005]'
32 | int fa[maxn],rd[maxn],n,h,m=400,active[maxn],get[maxn];
| ^~~
a.cc:54:46: error: reference to 'get' is ambiguous
54 | rep(i,1,m)if(i==find(i)&&active[i]&&!get[i]){
| ^~~
/usr/include/c++/14/variant:1180:5: note: candidates are: 'template<class _Tp, class ... _Types> constexpr const _Tp&& std::get(const variant<_Types ...>&&)'
1180 | get(const variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/variant:1170:5: note: 'template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const variant<_Types ...>&)'
1170 | get(const variant<_Types...>& __v)
| ^~~
/usr/include/c++/14/variant:1160:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp&& std::get(variant<_Types ...>&&)'
1160 | get(variant<_Types...>&& __v)
| ^~~
/usr/include/c++/14/variant:1150:5: note: 'template<class _Tp, class ... _Types> constexpr _Tp& std::get(variant<_Types ...>&)'
1150 | get(variant<_Types...>& __v)
| ^~~
/usr/include/c++/14/variant:1748:5: note: 'template<long |
s099582289 | p03669 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
///////////////////////
int const N = 1e5 + 41;
int const H = 241;
int n, h, a[N], b[N], c[N], d[N];
vector<pii> e[H][2];
int pe[H][2], q;
pii v;
void yes(){
printf("YES\n");
exit(0);
}
pii getfrom(int a, int c){
if(c == 0){
return mp(a, 1);
}else{
return mp(c, 0);
}
}
pii getto(int a, int c){
if(c == 0){
return mp(a, 0);
}else{
return mp(c, 1);
}
}
void dfs(pii x){
v = x;
int p = pe[x.first][x.second];
while(pe[x.first][x.second] < sz(e[x.first][x.second])){
pii y = e[x.first][x.second][pe[x.first][x.second]];
++pe[x.first][x.second];
++q;
dfs(y);
}
}
void solve(){
fi(0, n){
pii x = getfrom(a[i], c[i]);
pii y = getto(b[i], d[i]);
e[x.first][x.second].pb(y);
}
fi(1, h+1){
memset(pe, 0, sizeof(pe));
q = 0;
dfs(mp(i, 1));
if(q == n && v.second == 0) yes();
}
}
int main(){
#ifdef _DEBUG
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
scanf("%d %d",&n,&h);
fi(0, n){
scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
}
solve();
printf("NO\n");
return 0;
} | a.cc: In function 'void solve()':
a.cc:62:17: error: 'memset' was not declared in this scope
62 | memset(pe, 0, sizeof(pe));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<vector>
+++ |+#include <cstring>
4 |
|
s170573692 | p03669 | C++ | #include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
typedef long long llint;
const int MAX = 444;
vector<int> E[MAX];
bool bio[MAX];
int inDeg[MAX];
int outDeg[MAX];
int N, H;
vector<int> v;
void dfs(int x) {
if (bio[x]) return;
bio[x] = true;
v.push_back(x);
for (int y: E[x]) dfs(y);
}
bool solve() {
REP(i, 2*H) {
if (!bio[i] && E[i].size()) {
v.clear();
dfs(i);
bool haveStart = false;
bool haveEnd = false;
int balance = 0;
for (int x: v) {
if (x < H) {
haveStart = true;
if (inDeg[x] > outDeg[x]) return false;
balance += outDeg[x] - inDeg[x];
} else {
haveEnd = true;
if (inDeg[x] < outDeg[x]) return false;
balance -= inDeg[x] - outDeg[x];
}
}
if (!haveStart || !haveEnd || balance != 0) return false;
}
}
return true;
}
int main(void) {
scanf("%d %d", &N, &H);
REP(i, N) {
int A, B, C, D;
scanf("%d %d %d %d", &A, &B, &C, &D);
int u = C == 0 ? A-1 : H+C-1;
int v = D == 0 ? H+B-1 : D-1;
E[u].push_back(v);
E[v].push_back(u);
outDeg[u]++;
inDeg[v]++;
}
puts(solve() ? "YES" : "NO");
return 0;
}
| a.cc:17:1: error: 'vector' does not name a type
17 | vector<int> E[MAX];
| ^~~~~~
a.cc:24:1: error: 'vector' does not name a type
24 | vector<int> v;
| ^~~~~~
a.cc: In function 'void dfs(int)':
a.cc:29:3: error: 'v' was not declared in this scope
29 | v.push_back(x);
| ^
a.cc:30:15: error: 'E' was not declared in this scope
30 | for (int y: E[x]) dfs(y);
| ^
a.cc: In function 'bool solve()':
a.cc:35:20: error: 'E' was not declared in this scope
35 | if (!bio[i] && E[i].size()) {
| ^
a.cc:36:7: error: 'v' was not declared in this scope
36 | v.clear();
| ^
a.cc: In function 'int main()':
a.cc:69:5: error: 'E' was not declared in this scope
69 | E[u].push_back(v);
| ^
|
s154982523 | p03669 | C++ | #include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <functional>
#include <set>
#include <ctime>
#include <random>
#include <chrono>
#include <cassert>
#include <tuple>
#include <utility>
using namespace std;
namespace {
using Integer = long long; //__int128;
template<class T, class S> istream& operator >> (istream& is, pair<T,S>& p){return is >> p.first >> p.second;}
template<class T> istream& operator >> (istream& is, vector<T>& vec){for(T& val: vec) is >> val; return is;}
template<class T> istream& operator , (istream& is, T& val){ return is >> val;}
template<class T, class S> ostream& operator << (ostream& os, const pair<T,S>& p){return os << p.first << " " << p.second;}
template<class T> ostream& operator << (ostream& os, const vector<T>& vec){for(size_t i=0; i<vec.size(); i++) os << vec[i] << (i==vec.size()-1?"":" "); return os;}
template<class T> ostream& operator , (ostream& os, const T& val){ return os << " " << val;}
template<class H> void print(const H& head){ cout << head; }
template<class H, class ... T> void print(const H& head, const T& ... tail){ cout << head << " "; print(tail...); }
template<class ... T> void println(const T& ... values){ print(values...); cout << endl; }
template<class H> void eprint(const H& head){ cerr << head; }
template<class H, class ... T> void eprint(const H& head, const T& ... tail){ cerr << head << " "; eprint(tail...); }
template<class ... T> void eprintln(const T& ... values){ eprint(values...); cerr << endl; }
class range{ Integer start_, end_, step_; public: struct range_iterator{ Integer val, step_; range_iterator(Integer v, Integer step) : val(v), step_(step) {} Integer operator * (){return val;} void operator ++ (){val += step_;} bool operator != (range_iterator& x){return step_ > 0 ? val < x.val : val > x.val;} }; range(Integer len) : start_(0), end_(len), step_(1) {} range(Integer start, Integer end) : start_(start), end_(end), step_(1) {} range(Integer start, Integer end, Integer step) : start_(start), end_(end), step_(step) {} range_iterator begin(){ return range_iterator(start_, step_); } range_iterator end(){ return range_iterator( end_, step_); } };
inline string operator "" _s (const char* str, size_t size){ return move(string(str)); }
constexpr Integer my_pow(Integer x, Integer k, Integer z=1){return k==0 ? z : k==1 ? z*x : (k&1) ? my_pow(x*x,k>>1,z*x) : my_pow(x*x,k>>1,z);}
constexpr Integer my_pow_mod(Integer x, Integer k, Integer M, Integer z=1){return k==0 ? z%M : k==1 ? z*x%M : (k&1) ? my_pow_mod(x*x%M,k>>1,M,z*x%M) : my_pow_mod(x*x%M,k>>1,M,z);}
constexpr unsigned long long operator "" _ten (unsigned long long value){ return my_pow(10,value); }
inline int k_bit(Integer x, int k){return (x>>k)&1;} //0-indexed
mt19937 mt(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count());
template<class T> string join(const vector<T>& v, const string& sep){ stringstream ss; for(size_t i=0; i<v.size(); i++){ if(i>0) ss << sep; ss << v[i]; } return ss.str(); }
inline string operator * (string s, int k){ string ret; while(k){ if(k&1) ret += s; s += s; k >>= 1; } return ret; }
}
constexpr long long mod = 9_ten + 7;
typedef struct{
int to;
int cap;
int rev;
}edge;
// node v : distance from s => level[v]
void bfs(vector<vector<edge> > &G, vector<int> &level, int s){
fill(level.begin(), level.end(), -1);
queue<int> q;
q.push(s);
level[s] = 0;
while(!q.empty()){
int e=q.front(); q.pop();
for(int i=0; i<G[e].size(); i++){
if(G[e][i].cap > 0 && level[G[e][i].to] < 0){
level[G[e][i].to] = level[e] + 1;
q.push(G[e][i].to);
}
}
}
}
int dfs(vector<vector<edge> > &G, vector<int> &level, vector<bool> &used, vector<int> &iter, int s, int f, int t){
if(s==t) return f;
else{
//iter[e] : done searching from v[0] to v[ iter[e]-1 ]
for(int &i=iter[s]; i<G[s].size(); i++){
//distance from s to v[e][i].to must be longer than dist from s to v
if(G[s][i].cap > 0 && level[s] < level[ G[s][i].to ]){
int d = dfs(G, level, used, iter, G[s][i].to, min(f, G[s][i].cap), t);
if(d>0){
G[s][i].cap -= d;
G[ G[s][i].to ][ G[s][i].rev ].cap += d;
return d;
}
}
}
return 0;
}
}
int dinic_maxflow(vector<vector<edge> > &G, int s, int t){
const int INF = 100000000;
int flow=0;
while(true){
vector<int> level(G.size(), -1);
vector<int> iter(G.size(), 0);
vector<bool> used(G.size(), false);
bfs(G, level, s);
if(level[t] < 0) return flow; //unable to achieve to t
while(true){
int f = dfs(G, level, used, iter, s, INF, t);
if(f==0) break;
else flow += f;
}
}
}
void add_edge(vector<vector<edge> > &G, int from, int to, int cap){
G[from].push_back((edge){to, cap, (int)G[to].size()});
G[to].push_back((edge){from, 0, (int)G[from].size() - 1});
}
int main(){
int n,h;
cin >> n,h;
vector<int> a(n),b(n),c(n),d(n);
for(int i=0; i<n; i++){
cin >> a[i],b[i],c[i],d[i];
}
map<pair<int,int>, int> in_cnt;
map<pair<int,int>, int> out_cnt;
for(int i=0; i<n; i++){
if( c[i] == 0 ){
in_cnt[ {a[i], 0} ]++;
}else{
in_cnt[ {c[i], 1} ]++;
}
if( d[i] == 0 ){
out_cnt[ {b[i], 0} ]++;
}else{
out_cnt[ {d[i], 1} ]++;
}
}
map<tuple<int,int,int>, int> dict;
int idx = 0;
for(auto p : in_cnt){
auto t = make_tuple(0, p.first.first, p.first.second);
dict[t] = idx;
idx++;
}
for(auto p : out_cnt){
auto t = make_tuple(1, p.first.first, p.first.second);
dict[t] = idx;
idx++;
}
int zero_0 = idx++;
int zero_1 = idx++;
int source = idx++;
int sink = idx++;
int super_source = idx++;
int super_sink = idx++;
vector<vector<edge>> G(idx);
add_edge(G, zero_0, zero_1, n+10);
add_edge(G, super_source, zero_1, 1);
add_edge(G, zero_0, super_sink, 1);
for(auto p : in_cnt){
auto t = make_tuple(0, p.first.first, p.first.second);
int v = dict[t];
add_edge(G, v, sink, p.second);
if( p.first.second == 0 ){
add_edge(G, zero_1, v, p.second);
}
}
for(auto p : out_cnt){
auto t = make_tuple(1, p.first.first, p.first.second);
int v = dict[t];
add_edge(G, source, v, p.second);
auto r = make_tuple(0, p.first.first, p.first.second^1);
if( dict.count(r) ){
add_edge(G, v, dict[r], p.second);
}
if( p.first.second == 0 ){
add_edge(G, v, zero_0, p.second);
}
}
int f = 0;
f += dinic_maxflow(G, super_source, sink);
f += dinic_maxflow(G, source, super_sink);
if( f != 2 ){
println("NO");
return 0;
}
f--;
add_edge(G, super_source, source, n+100);
add_edge(G, sink, super_sink, n+100);
f += dinic_maxflow(G, super_source, super_sink);
f += dinic_maxflow(G, souce, sink);
println( f==n ? "YES" : "NO");
return 0;
}
| a.cc: In function 'int main()':
a.cc:203:25: error: 'souce' was not declared in this scope; did you mean 'source'?
203 | f += dinic_maxflow(G, souce, sink);
| ^~~~~
| source
|
s876650303 | p03669 | C++ | #include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pf push_front
#define pb2 pop_back
#define pf2 pop_front
#define line printf("\n")
#define pq priority_queue
#define rep(k,i,j) for(int k = (int)i;k<(int)j;k++)
#define repd(k,i,j) for(int k = (int)i;k>=(int)j;k--)
#define ll long long
#define ALL(a) a.begin(),a.end()
#define vi vector<int>
using namespace std;
double EPS = 1e-9;
int INF = 1e9+7;;
long long INFLL = 1e17;
double pi = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
clock_t first_attempt = clock();
inline void cek_time(){
clock_t cur = clock()- first_attempt;
cerr<<"TIME : "<<(double) cur/CLOCKS_PER_SEC<<endl;
}
inline void OPEN (string s) {
freopen ((s + ".in").c_str (), "r", stdin);
freopen ((s + ".out").c_str (), "w", stdout);
}
//end of template
int n,H;
const int maxn= 1e5+4;
int deg[maxn];
vi adj[maxn];
void add_edge(int a,int b){
deg[a]++;
deg[b]--;
adj[a].pb(b);
// printf("%d -> %d\n",a,b);
}
int bisa = 1;
int cycle2(int st){
int a = st;
while(1){
if(adj[a].size()==0){bisa= 0;return;}
int b = adj[a].back();
adj[a].pb2();
a = b;
if(a==st)return;
}
}
void cycle(int st){
int a = st;
while(1){
if(adj[a].size()==0){bisa= 0;return;}
int b = adj[a].back();
adj[a].pb2();
a = b;
if(a<H)return;
}
}
int main(){
scanf("%d%d",&n,&H);
H+=2;
rep(k,0,n){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
a+= c;
b+= d;
swap(a,c);swap(b,d);
if(!a && !b){
add_edge(c,d);
}
if(!a && b){
add_edge(c,b + H);
}
if(a && !b){
add_edge(a+H,d);
}
if(a && b){
add_edge(a+H,b + H);
}
}
rep(k,0,H){
while(adj[k].size())cycle(k);
}
rep(k,H,2*H+1){
while(adj[k].size())cycle2(k);
}
printf("%s\n",bisa?"YES":"NO");
return 0;
}
| a.cc: In function 'int cycle2(int)':
a.cc:58:47: error: return-statement with no value, in function returning 'int' [-fpermissive]
58 | if(adj[a].size()==0){bisa= 0;return;}
| ^~~~~~
a.cc:62:26: error: return-statement with no value, in function returning 'int' [-fpermissive]
62 | if(a==st)return;
| ^~~~~~
|
s539337260 | p03670 | C++ | #include <bits/stdc++.h>
#define ln '\n'
#define all(dat) dat.begin(), dat.end()
#define loop(i, to) for (int i = 0; i < to; ++i)
#define cont(i, to) for (int i = 1; i <= to; ++i)
#define circ(i, fm, to) for (int i = fm; i <= to; ++i)
#define foreach(i, dat) for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
typedef long long num;
using namespace std;
template<int mod>
struct modulo {
int w;
operator int&() { return w; }
operator int() const { return w; }
modulo() {}
modulo(int w, bool f = 0) { this->w = w; if (f) fix(); }
void inline fix() { w %= mod; if (w < 0) w += mod; }
modulo inline fix(int w) const { w %= mod; if (w < 0) w += mod; return w; }
inline modulo operator - () { w = -w + mod; return *this; }
inline modulo& operator += (const modulo &b) { if ((w += b.w) >= mod) w -= mod; return *this; }
inline modulo& operator -= (const modulo &b) { if ((w -= b.w) < 0) w += mod; return *this; }
inline modulo& operator *= (const modulo &b) { w = (num) w * b.w % mod; return *this; }
inline modulo& operator /= (const modulo &b) { w = (num) w * b.inv() % mod; return *this; }
inline modulo operator + (const modulo &b) { modulo r = *this; r += b; return r; }
inline modulo operator - (const modulo &b) { modulo r = *this; r -= b; return r; }
inline modulo operator * (const modulo &b) { modulo r = *this; r *= b; return r; }
inline modulo operator / (const modulo &b) { modulo r = *this; r /= b; return r; }
modulo inline inv() const {
int a = w, m = mod, u = 0, v = 1, t;
for (; a != 0; t = m / a, m -= t * a, swap(a, m), u -= t * v, swap(u, v));
return fix(u);
}
modulo inline pow(int p) const {
if (!w) return 0;
modulo a = *this, r = 1;
for (; p > 0; a *= a, p >>= 1) if (p & 1) r *= a;
return r;
}
};
const int mod = int(1000000007);
typedef modulo<mod> rem;
const int nsz = 20, msksz = (1 << nsz) - 1;
int n, m, k, full, g[nsz + 5][nsz + 5], lg[msksz + 5];
rem dp[nsz + 5][nsz + 5][msksz + 5], ans;
int inline lowbit(int S) { return S & -S; }
int inline at(int S, int id) { return S >> id & 1; }
int inline chg(int S, int id, int w) { return S + ((w - at(S, id)) << id); }
string inline bin(int S) {
string s;
loop (i, n) s += at(S, i) + '0';
return s;
}
int main() {
ios::sync_with_stdio(0);
cin >> n >> k >> m;
full = (1 << n) - 1;
memset(g, -1, sizeof(g));
cont (i, m) {
int id, lvl, d;
cin >> id >> lvl >> d;
--id, --lvl;
g[id][lvl] = d;
}
loop (i, n) lg[1 << i] = i;
dp[0][0][0] = 1;
loop (i, k) {
// cerr << i << " -> " << i + 1 << ln;
loop (j, n) {
circ (S, 0, full) {
rem val = dp[i][j][S];
if (!val) continue;
// cerr << i << ' ' << j << " (" << g[i][j] << ") " << ' ' << bin(S) << ": " << val << ln;
if (j == n - 1) dp[i + 1][0][S] += val;
if (j == n - 1) continue;
if (at(S, j) == 0) {
if (g[i][j] == 0 || g[i][j] == -1) {
// cerr << " -> " << i << ' ' << j + 1 << ' ' << bin(S) << ln;
dp[i][j + 1][S] += val;
}
if (g[i][j] == 1 || g[i][j] == -1) {
int T = S & (full ^ ((1 << j) - 1));
int to = lg[lowbit(T)];
int nS = chg(to > j ? chg(S, to, 0) : S, j, 1);
// cerr << bin(T) << ' ' << to << ln;
// cerr << bin(S) << " => " << bin(to > j ? chg(S, to, 0) : S) << ' ' << bin(nS) << ln;
// cerr << " -> " << i << ' ' << j + 1 << ' ' << bin(nS) << ln;
dp[i][j + 1][nS] += val;
}
} else {
if (g[i][j] == 1 || g[i][j] == -1) {
// cerr << " -> " << i << ' ' << j + 1 << ' ' << bin(S) << ln;
dp[i][j + 1][S] += val;
}
}
// cerr << ln;
}
}
}
circ (S, 0, full) {
ans += dp[k - 1][n - 1][S];
}
cout << ans << ln;
} | /tmp/cc4vm9Jb.o: in function `main':
a.cc:(.text+0x5e6): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc4vm9Jb.o
a.cc:(.text+0x604): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc4vm9Jb.o
/tmp/cc4vm9Jb.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x6aa): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc4vm9Jb.o
collect2: error: ld returned 1 exit status
|
s916163306 | p03670 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,j,l) for(int i=j;i<=l;++i)
#define fd(i,j,l) for(int i=j;i>=l;--i)
using namespace std;
typedef long long LL;
const LL N=21,M=(1<<19)+3,mo=1e9+7;
int dir[N][N],m2[N],next[N];
int n,m,k,a,b,c;
LL f[2][N][M],g[N][M];
int main()
{
cin>>n>>m>>k; --n;
fo(i,1,k){
scanf("%d%d%d",&a,&b,&c);
dir[a][b]=c+1;
}
int u=0,v;
f[0][0][0]=1;
m2[1]=1;
fo(i,2,n+1)m2[i]=m2[i-1]<<1;
int zd=(m2[n]<<1)-1;
fo(p,1,m){
v=u^1;
fo(l,0,n)fo(i,0,zd)f[v][l][i]=0;
fo(l,0,n)fo(i,0,zd)g[l][i]=0;
fd(i,zd,0){
LL ok=f[u][0][i]%mo; next[n]=n+1;
fd(l,n,2)if(i&m2[l])next[l-1]=l;else next[l-1]=next[l];
if(!i)g[0][0]=ok;
fo(l,1,n){
if((i&m2[l])==0&&dir[p][l]!=1&&next[l]!=n+1)
f[u][l][(i^m2[next[l]])^m2[l]]=f[u][l][(i^m2[next[l]])^m2[l]]+ok;
ok=(f[u][l][i]+ok)%mo;
if(dir[p][l]&&(((i&m2[l])>0)-(dir[p][l]==2)))break;
if(next[l]==n+1&&(i&m2[l])>0)g[l][i]=ok;
}
}
fo(i,0,n-1)
fo(l,0,zd)if(g[i][l]){
g[i][l]=g[i][l]%mo;
if(dir[p][i+1]!=2)g[i+1][l]=g[i+1][l]+g[i][l];
if(dir[p][i+1]!=1)g[i+1][l^m2[i+1]]=g[i+1][l^m2[i+1]]+g[i][l];
}
fo(i,0,zd)f[v][0][i]=g[n][i];
u=v;
}
LL ans=0;
fo(i,0,zd)ans=(ans+f[v][0][i])%mo;
cout<<ans;
} | a.cc: In function 'int main()':
a.cc:34:46: error: reference to 'next' is ambiguous
34 | LL ok=f[u][0][i]%mo; next[n]=n+1;
| ^~~~
In file included from /usr/include/c++/14/string:47,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
a.cc:35:45: error: reference to 'next' is ambiguous
35 | fd(l,n,2)if(i&m2[l])next[l-1]=l;else next[l-1]=next[l];
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
a.cc:35:62: error: reference to 'next' is ambiguous
35 | fd(l,n,2)if(i&m2[l])next[l-1]=l;else next[l-1]=next[l];
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
a.cc:35:72: error: reference to 'next' is ambiguous
35 | fd(l,n,2)if(i&m2[l])next[l-1]=l;else next[l-1]=next[l];
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
a.cc:38:64: error: reference to 'next' is ambiguous
38 | if((i&m2[l])==0&&dir[p][l]!=1&&next[l]!=n+1)
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
a.cc:39:47: error: reference to 'next' is ambiguous
39 | f[u][l][(i^m2[next[l]])^m2[l]]=f[u][l][(i^m2[next[l]])^m2[l]]+ok;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
a.cc:39:78: error: reference to 'next' is ambiguous
39 | f[u][l][(i^m2[next[l]])^m2[l]]=f[u][l][(i^m2[next[l]])^m2[l]]+ok;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
a.cc:42:36: error: reference to 'next' is ambiguous
42 | if(next[l]==n+1&&(i&m2[l])>0)g[l][i]=ok;
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:13:21: note: 'int next [21]'
13 | int dir[N][N],m2[N],next[N];
| ^~~~
|
s605208982 | p03670 | C++ | #include<bits/stdc++.h>
using namespace std;
const int MX=21,MXM=1<<19|1
int d[MXM],f[MXM],md=1000000007;
int n,m,K,u[MX][MX],ans;
#define lb(x) ((x)&(-(x)))
int main() {
int i,j,a,b,c,k;
cin>>n>>m>>K;
for(i=0;i<K;i++)cin>>a>>b>>c,u[a-1][b-1]=c+1;
d[0]=1;
#define A(x) (f[x]=(f[x]+d[k])%md)
for(i=0;i<m;i++)for(j=0;j<n-1;j++){
for(k=0;k<(1<<(n-1));k++){
if(!((k>>j)&1)&&u[i][j]!=2)A(k);
if(u[i][j]!=1){
if((k>>j)&1)A(k);
else A(k+(1<<j)-(lb(k>>j)<<j));
}
}
memcpy(d,f,sizeof(int)*(1<<(n-1)));
memset(f,0,sizeof(int)*(1<<(n-1)));
}
for(i=0;i<(1<<(n-1));i++)ans=(ans+d[i])%md;
cout<<ans<<endl;
return 0;
} | a.cc:5:1: error: expected ',' or ';' before 'int'
5 | int d[MXM],f[MXM],md=1000000007;
| ^~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'd' was not declared in this scope
12 | d[0]=1;
| ^
a.cc:13:23: error: 'f' was not declared in this scope
13 | #define A(x) (f[x]=(f[x]+d[k])%md)
| ^
a.cc:16:52: note: in expansion of macro 'A'
16 | if(!((k>>j)&1)&&u[i][j]!=2)A(k);
| ^
a.cc:13:40: error: 'md' was not declared in this scope; did you mean 'm'?
13 | #define A(x) (f[x]=(f[x]+d[k])%md)
| ^~
a.cc:16:52: note: in expansion of macro 'A'
16 | if(!((k>>j)&1)&&u[i][j]!=2)A(k);
| ^
a.cc:13:23: error: 'f' was not declared in this scope
13 | #define A(x) (f[x]=(f[x]+d[k])%md)
| ^
a.cc:18:45: note: in expansion of macro 'A'
18 | if((k>>j)&1)A(k);
| ^
a.cc:13:40: error: 'md' was not declared in this scope; did you mean 'm'?
13 | #define A(x) (f[x]=(f[x]+d[k])%md)
| ^~
a.cc:18:45: note: in expansion of macro 'A'
18 | if((k>>j)&1)A(k);
| ^
a.cc:13:23: error: 'f' was not declared in this scope
13 | #define A(x) (f[x]=(f[x]+d[k])%md)
| ^
a.cc:19:38: note: in expansion of macro 'A'
19 | else A(k+(1<<j)-(lb(k>>j)<<j));
| ^
a.cc:13:40: error: 'md' was not declared in this scope; did you mean 'm'?
13 | #define A(x) (f[x]=(f[x]+d[k])%md)
| ^~
a.cc:19:38: note: in expansion of macro 'A'
19 | else A(k+(1<<j)-(lb(k>>j)<<j));
| ^
a.cc:22:26: error: 'f' was not declared in this scope
22 | memcpy(d,f,sizeof(int)*(1<<(n-1)));
| ^
a.cc:25:49: error: 'md' was not declared in this scope; did you mean 'm'?
25 | for(i=0;i<(1<<(n-1));i++)ans=(ans+d[i])%md;
| ^~
| m
|
s882854345 | p03670 | C++ | test_code | a.cc:1:1: error: 'test_code' does not name a type
1 | test_code
| ^~~~~~~~~
|
s442481532 | p03670 | C++ | #include<bits/stdc++.h>
#define mo 1000000007
//#define add(a,b) (a+b>=mo)?(a+=b-mo):(a+=b)
#define lowbit(s) ((s)&(-(s)))
using namespace std;
int f[2][22][1<<20],a[22][22];
inline void add(int &a,int b){(a+b>=mo)?(a+=b-mo):(a+=b);}
int main()
{
int n,m,q;scanf("%d%d%d",&n,&m,&q);
memset(a,255,sizeof(a));
while (q--)
{
int u,v,w;scanf("%d%d%d",&u,&v,&w);
a[u][v]=w;
}
f[1][0][0]=1;
for (int i=1;i<=m;i++)
{
memset(f[(i&1)^1],0,sizeof(f[(i&1)^1]));
for (int j=0;j<n;j++)
{
for (int s=0;s<(1<<(n-1));s++) if (f[i&1][j][s])
{
//cout<<i<<' '<<j<<' '<<s<<' '<<f[i][j][s]<<endl;
if (j==n-1)
{
add(f[(i&1)^1][0][s],f[i&1][j][s]);
}
else
{
add(f[i&1][j+1][s],f[i&1][j][s]*((a[i][j+1]!=1)&&((s&(1<<j))==0)));
add(f[i&1][j+1][s+(!(bool)(s&(1<<j)))*(-(lowbit(s>>j)<<j)+(1<<j))],f[i&1][j][s]*(a[i][j+1]!=0));
}
}
}
int ans=0;
for (int s=0;s<(1<<(n-1));s++) add(ans,f[m&1][n-1][s]);
printf("%d\n",ans);
}
| a.cc: In function 'int main()':
a.cc:41:2: error: expected '}' at end of input
41 | }
| ^
a.cc:9:1: note: to match this '{'
9 | {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.