submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s481766954
p03688
C++
n = int(input()) a = list(map(int,input().split())) a.sort() if a[-1] - a[0] >= 2: print("No") elif a[-1] - a[0] == 1: m = 0 for x in a: if x == a[0]: m += 1 else: break if a[-1]-m <= (n-m)//2 and a[-1]-m > 0: print("Yes") else: print("No") else: if a[0] == n-1 or a[0] <= n//2: print("Yes") else: print("No")
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s004770576
p03688
C++
#include<bits/stdc++.h> using namespace std; int a[1000005],T,n; bool check(int m,int k) { // cout<<m<<' '<<k<<endl; if(k==0) return false; if(m/k>1) return true; return false; } int main() { // scanf("%d",&T); // while(T--) { memset(a,0,sizeof(a)); int maxn=0; bool flag=0; scanf("%d",&n); for(int i=1;i<=n;i++) { int x; scanf("%d",&x); maxn=max(maxn,x),a[x]++; if(x!=maxn&&x!=maxn-1) flag=1; } if(flag) {printf("No\n");continue;} if(n==1&&a[0]!=1) {printf("No\n");continue;} if((a[maxn]==n&&maxn==n-1)||(a[maxn]==n&&maxn==1)) {printf("Yes\n");continue;} if(check(n-a[maxn-1],maxn-a[maxn-1])) {printf("Yes\n");continue;} printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:27:49: error: continue statement not within a loop 27 | if(flag) {printf("No\n");continue;} | ^~~~~~~~ a.cc:28:57: error: continue statement not within a loop 28 | if(n==1&&a[0]!=1) {printf("No\n");continue;} | ^~~~~~~~ a.cc:29:90: error: continue statement not within a loop 29 | if((a[maxn]==n&&maxn==n-1)||(a[maxn]==n&&maxn==1)) {printf("Yes\n");continue;} | ^~~~~~~~ a.cc:30:74: error: continue statement not within a loop 30 | if(check(n-a[maxn-1],maxn-a[maxn-1])) {printf("Yes\n");continue;} | ^~~~~~~~
s544916300
p03688
C++
#include<bits/stdc++.h> using namespace std; #define Min(x,y)(x<y?x:y) #define Max(x,y)(x>y?x:y) #define For(i,x,y)for(i=x;i<=y;i++) int a[10005],n,mn; void Subtask() { puts((n/mn>1||mn==n-1?"Yes":"No")); } int main() { int t,mx,i,p; t=read(); while(t--) { cin>>n; mn=n+1; mx=p=0; For(i,1,n) { cin>>a[i]; mn=Min(mn,a[i]); mx=Max(mx,a[i]); } if(mn==mx) { Subtask(); continue; } /*cout<<mn<<mx<<endl;*/ For(i,1,n)p+=a[i]==mn; puts((p>=mx||(n-p)/(mx-p)<=1?"No":"Yes")); } return 0; }
a.cc: In function 'int main()': a.cc:14:15: error: too few arguments to function 'ssize_t read(int, void*, size_t)' 14 | t=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 | ^~~~
s720085860
p03688
C++
#include<bits/stdc++.h> #define ts cout<<"ok"<<endl #define int long long #define hh puts("") #define pc putchar //#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) //char buf[1<<21],*p1=buf,*p2=buf; using namespace std; const int N=10005; int n,a[N]; inline int read(){ int ret=0,ff=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-') ff=-1;ch=getchar();} while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();} return ret*ff; } void write(int x){if(x<0){x=-x,pc('-');}if(x>9) write(x/10);pc(x%10+48);} void writeln(int x){write(x),hh;} void writesp(int x){write(x),pc(' ');} signed main(){ n=read(); int mx=0,mn=1e9; for(int i=1;i<=n;i++){ a[i]=read(); mx=max(mx,a[i]); mn=min(mn,a[i]); } if(mx-mn>1){ puts("No"); continue; } if(mx==mn){ if(mx<=n/2||mx==n-1) puts("Yes"); else puts("No"); } else{ int c1=0,c2=0; for(int i=1;i<=n;i++){ c1+=(a[i]==mn); c2+=(a[i]==mx); } if(mx-c1>=1&&mx-c1<=c2/2) puts("Yes"); else puts("No"); } return 0; }
a.cc: In function 'int main()': a.cc:30:17: error: continue statement not within a loop 30 | continue; | ^~~~~~~~
s361836941
p03688
C++
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = (1 << 28); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() #define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } //setprecision(15)有効数字15桁 //-std=c++14 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} ll lcm(ll a, ll b){return a * b / gcd(a, b);} int n, m; vector<int> a; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> n; //同じ数で一個のグループができたら死 int maxa=0, mina=INF; map<int,int> m; for (int i = 0; i < n; i++) { int temp; cin >> temp; a.push_back(temp); m[temp]++; chmax(maxa,temp); chmin(mina,temp); } sort(ALL(a)); if(maxa-mina>1)return no,0; if(maxa-mina==0){ if(a[0]==n-1)return yes,0; if(n/a[0]>=2){ return yes,0; } } else{ if(m[a[n-1]]<2){ return no,0; } if(m[a[0]]+m[a[n-1]]/2=<a[n-1]&&m[a[0]]+1>=a[n-1])return yes,0; } no; }
a.cc: In function 'int main()': a.cc:54:32: error: expected primary-expression before '<' token 54 | if(m[a[0]]+m[a[n-1]]/2=<a[n-1]&&m[a[0]]+1>=a[n-1])return yes,0; | ^
s779576565
p03688
C++
// CODE by Kazhybay Askar //#include <ext/pb_ds/assoc_cont ainer.hpp> //#include <ext/pb_ds/tree_policy.hpp> #include <bits/stdc++.h> using namespace std; //using namespace __gnu_pbds; //#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define f first #define s second #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define sz size() #define all(x) x.begin(),x.end() #define cont continue #define r0 return 0 #define endl '\n' typedef long long ll; typedef long double ld; typedef pair<ll,ll> pll; typedef pair<int,int> pii; typedef pair<char,char> pcc; const int MAXN = 5e5 + 7; const int MOD = 1e9 + 7; const int INF = 1e9 + 7; const ll MINF = 1e18 + 7; const int EPS = 1e-6; const int dx[] = {0, 0, 1, -1, -1, -1, 1, 1}; const int dy[] = {1, -1, 0, 0, -1, 1, -1, 1}; const double pi = acos(-1.0); ll n,a[MAXN],cnt,cntr,cntr1,mx,mn=INF; void solve(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; if(a[i]==1){ cnt++; } if(a[i]==n-1){ cntr++; } if(a[i]>n/2){ cntr1++; } mx=max(mx,a[i]); mn=min(mn,a[i]); } if(cnt>1 && cnt!=n){ cout<<"NO"; return; } else if(cntr>1 && cntr<n/2){kvh cout<<"NO"; return; } else if(cntr==n){ cout<<"YES"; return; } else if(cntr1==n){ cout<<"NO"; } else cout<<"YES"; } int main(){ Speed; ll T=1; //cin>>T; while(T--){ solve(); } r0; }
a.cc: In function 'void solve()': a.cc:63:33: error: 'kvh' was not declared in this scope 63 | else if(cntr>1 && cntr<n/2){kvh | ^~~
s833474234
p03688
C++
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 123; int n, a[N], mx = 0, mn = 1e5 + 123; int main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; mx = max(mx, a[i]); mn = min(mn, a[i]); } if(mx - mn >= 2){ cout << "No"; exit(0); } if(mx - mn == 0){ if(n == 3 && a[i] <= 2) cout << "Yes"; else if(a[i] <= n / 2) cout << "Yes"; else cout << "No"; exit(0); } else{ cout << "No"; } }
a.cc: In function 'int main()': a.cc:20:32: error: 'i' was not declared in this scope 20 | if(n == 3 && a[i] <= 2) cout << "Yes"; | ^
s943051630
p03688
C++
using namespace std; const int N = 1e5 + 11; int n, a[N], ma; int main(){ cin>>n; for(int i = 1;i <= n; i++){ scanf("%d", &a[i]); ma = max(ma, a[i]); } int dl = 0; for(int i = 1;i <= n; i++){ if(ma - a[i] > 1){ puts("No"); return 0; } else if(ma - a[i])dl++; } if(dl == 0){ if(ma == n - 1 || ma * 2 <= n)puts("Yes"); else puts("No"); } else{ if(n - dl < 2 * (ma - dl) || ma <= dl) puts("No"); else puts("Yes"); } return 0; }
a.cc: In function 'int main()': a.cc:5:5: error: 'cin' was not declared in this scope 5 | cin>>n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:7:9: error: 'scanf' was not declared in this scope 7 | scanf("%d", &a[i]); | ^~~~~ a.cc:8:14: error: 'max' was not declared in this scope; did you mean 'ma'? 8 | ma = max(ma, a[i]); | ^~~ | ma a.cc:13:13: error: 'puts' was not declared in this scope 13 | puts("No"); | ^~~~ a.cc:19:39: error: 'puts' was not declared in this scope 19 | if(ma == n - 1 || ma * 2 <= n)puts("Yes"); | ^~~~ a.cc:20:14: error: 'puts' was not declared in this scope 20 | else puts("No"); | ^~~~ a.cc:23:48: error: 'puts' was not declared in this scope 23 | if(n - dl < 2 * (ma - dl) || ma <= dl) puts("No"); | ^~~~ a.cc:24:14: error: 'puts' was not declared in this scope 24 | else puts("Yes"); | ^~~~
s268672842
p03688
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(long long i=0;i<(long long)(n);i++) #define REP(i,k,n) for(long long i=k;i<(long long)(n);i++) #define all(a) a.begin(),a.end() #define eb emplace_back #define pb push_back #define lb(v,k) (lower_bound(all(v),k)-v.begin()) #define ub(v,k) (upper_bound(all(v),k)-v.begin()) typedef long long ll; typedef multiset<ll> S; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> PP; typedef priority_queue<ll> PQ; typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ; using vi=vector<ll>; using vvi=vector<vector<ll>>; const ll inf=1001001001001001; const int INF=1001001001; const int mod=1000000007; bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;} bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;} int main(){ int n;cin>>n; vi v(n); rep(i,n)cin>>v[i]; sort(all(v)); ll a=0,b=0; rep(i,n){ if(v[i]==v[0])a++; else if(v[i]==v[0]+1)b++; else { cout<<"No"<<endl; return 0; } } int m=-1; if(v[0]!=v[n-1])m++; if((v[0]+1-a)*2<=b&&m<v[0]+1-a){ cout<<"Yes"<<endl; return 0; } if(v[0]==v[n-1]){ if((v[0]-b)*2<=a&&m<v[0]-b){ cout<<"Yes"<<endl; return 0; } cout<<"No"<<endl; }
a.cc:21:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 21 | bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;} | ^~~~ a.cc:21:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 21 | bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;} | ^~~~ a.cc:22:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 22 | bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;} | ^~~~ a.cc:22:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 22 | bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;} | ^~~~ a.cc: In function 'int main()': a.cc:50:2: error: expected '}' at end of input 50 | } | ^ a.cc:24:11: note: to match this '{' 24 | int main(){ | ^
s500232115
p03688
C++
#include <bits/stdc++.h> using namespace std; #define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20); #define int long long #define gcd __gcd #define all(x) (x).begin(), (x).end() template<class T> bool chmax(T& a, T b){return (a = max(a, b)) == b;} template<class T> bool chmin(T& a, T b){return (a = min(a, b)) == b;} #define _overload(_1, _2, _3, name, ...) name #define _rep(i, n) repi(i, 0, n) #define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++) #define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__) #define _rev(i, n) revi(i, n, 0) #define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--) #define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__) #define each(i, n) for(auto&& i: n) const int INF = 1e18, MOD = 1e9 + 7; signed main() { INCANT; int n; cin>>n; int a[111111], mx = -INF, mn = INF, mxcnt = 0, mncnt = 0; rep(i, n) { cin>>a[i]; chmax(mx, a[i]); chmin(mn, a[i]); } if(mx == mn) { if(mx == n - 1 || 2 * mx <= n) cout<<"Yes"<<endl; else cout<<"No"<<endl; } else {  if(mx - mn > 1) { cout<<"No"<<endl; return 0; } rep(i, n) { if(a[i] == mx) mxcnt++; else mncnt++; } if(mncnt < mx && 2 * (mx - mncnt) <= mxcnt) cout<<"Yes"<<endl; else cout<<"No"<<endl; } }
a.cc:34:7: error: extended character   is not valid in an identifier 34 |  if(mx - mn > 1) { | ^ a.cc: In function 'int main()': a.cc:34:7: error: '\U00003000if' was not declared in this scope 34 |  if(mx - mn > 1) { | ^~~~
s094378448
p03688
C++
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int n; int a[MAXN]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int t = n - 2; while (t > 0 && a[t] == a[t + 1]) t--; if (a[0] ^ a[t] || (a[t] + 1) ^ a[n - 1] || ((t + 2) ^ a[n - 1] && a[t] ^ a[n - 1]) || ) return cout << "No" << '\n', 0; cout << "Yes" << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:18:96: error: expected primary-expression before ')' token 18 | if (a[0] ^ a[t] || (a[t] + 1) ^ a[n - 1] || ((t + 2) ^ a[n - 1] && a[t] ^ a[n - 1]) || ) | ^
s535697120
p03688
C++
#include<bits/stdc++.h> #define rep(i,k,n) for(int i =k;i<n;i++) using namespace std; int main() { int n,m,M; cin >> n; vector<int>(n)a; rep(i,0,n) { cin >> a[i]; } m=*std::min_element(a.begin(),a.end()); M=*std::max_element(a.begin(),a.end()); if(M-m>1) { cout << "No" << endl; } else { int c=0; rep(i,0,n) { if(a[i]==m) { ++c; } } if(M==m) { if(m==n-1||m<=n/2) { cout << "Yes" << endl; } else { cout << "No" << endl; } } else { if(M>c&&(n-c)/2>=M-c) { cout << "Yes" << endl; } else { cout << "No" << endl; } } } }
a.cc: In function 'int main()': a.cc:8:17: error: expected ';' before 'a' 8 | vector<int>(n)a; | ^ | ; a.cc:11:12: error: 'a' was not declared in this scope 11 | cin >> a[i]; | ^ a.cc:13:23: error: 'a' was not declared in this scope 13 | m=*std::min_element(a.begin(),a.end()); | ^
s791203633
p03688
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> a(N); int loop,isTrue=1; cin >> a[0]; int Max=a[0],min=a[0]; for(loop=1;loop<N;loop++){ cin >> a[loop]; if(Max<a[loop]){ Max=a[loop]; }else if(Min>a[loop]){ Min=a[loop]; } } if(Max-Min>1){ isTrue=0; }else if(Max-Min){ int colorable=Max-1; //人と完全に違う色を被った猫はMax-1匹以下であることが保証される //countの値はcolorable以下でなければならない int memberable=N-Max+1; //人と同じ色を被った猫はN-Max+1匹以下であることが保証される //N-countの値はmemberable以下でなければならない int count=0; for(loop=0;loop<N;loop++){ if(a[loop]==Min) count++; } if(colorable<count||memberable<N-count) isTrue=0; }else{ if(N-Max!=1&&N/2<Max){ isTrue=0; } } if(isTrue){ cout << "Yes" << endl; }else{ cout << "No" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:14: error: 'Min' was not declared in this scope; did you mean 'min'? 15 | }else if(Min>a[loop]){ | ^~~ | min a.cc:19:10: error: 'Min' was not declared in this scope; did you mean 'min'? 19 | if(Max-Min>1){ | ^~~ | min
s651344995
p03688
C++
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--) #define itn int #define all(x) (x).begin(),(x).end() #define F first #define S second const long long INF = 1LL << 60; const int MOD = 1000000007; vector <int> a; signed main(void){ int n; cin>>n; a.resize(n); rep(i,n) cin>>a[i]; sort(a.begin(),a.end()); bool same = true; rep(i,n-1) if(a[i] != a[i+1]) same = false; if(abs(a[0] - a[n-1])>=2) cout<<"No"<<endl; if(same){ if(a[i] == n-1 || 2*a[i] <=n) cout<<"Yes"<<endl; else cout<<"No"<<endl; }else{ int p = count(all(a), a[0]); int q = n-p; if(p<a[n-1]&& 2*(a[n-1]-p)<=q) cout<<"Yes"<<endl; else cout<<"No"<<endl; } }
a.cc: In function 'int main()': a.cc:22:14: error: 'i' was not declared in this scope 22 | if(a[i] == n-1 || 2*a[i] <=n) cout<<"Yes"<<endl; | ^
s387674622
p03688
C++
#include<bits/stdc++.h> using namespace std; int n,mk,num[100005],cc,bs[100005],col[100005]; bool pp=true,bi[100005]; long long ss; vector<int>pos; bool ch(int mm) { int r=mm,rr=0; memset(bs,0,sizeof(bs)); memset(col,0,sizeof(col)); bool p=true; if(pos.size()!=0) { if(r-aa==0)return false; int aa=pos.size(); for(int i=1;i<=n;i++) { if(bi[i])continue; else { bs[rr+aa]++; col[i]=rr+aa; rr++; rr%=(r-aa); } } for(int i=0;i<aa;i++) { bs[i]++; col[pos[i]]=i; } for(int i=1;i<=n;i++) { if(bs[col[i]]==1) { if(num[i]!=r-1)p=false; } else { if(num[i]!=r)p=false; } } } else { for(int i=1;i<=n;i++) { bs[rr]++; col[i]=rr; rr++; rr%=(r); } for(int i=1;i<=n;i++) { if(bs[col[i]]==1) { if(num[i]!=r-1)p=false; } else { if(num[i]!=r)p=false; } } } /*for(int i=1;i<=n;i++) { printf("%d ",col[i]); }*/ return p; } int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&num[i]); mk=max(num[i],mk); ss+=num[i]; } for(int i=1;i<=n;i++) { if(num[i]<mk)cc++,pos.push_back(i),bi[i]=true; if(num[i]<mk-1)pp=false; } if(ch(mk)) { printf("Yes"); } else { if(ch(mk+1)) { printf("Yes"); } else { printf("No"); } } }
a.cc: In function 'bool ch(int)': a.cc:15:22: error: 'aa' was not declared in this scope 15 | if(r-aa==0)return false; | ^~
s433800951
p03688
C++
#include<bits/stdc++.h> using namespace std; int n,mk,num[100005],cc,bs[100005],col[100005]; bool pp=true,bi[100005]; long long ss; vector<int>pos bool ch(int mm) { int r=mm,rr=0; memset(bs,0,sizeof(bs)); memset(col,0,sizeof(col)); bool p=true; if(pos.size()!=0) { int aa=pos.size(); for(int i=1;i<=n;i++) { if(bi[i])continue; else { bs[rr+aa]++; col[i]=rr+aa; rr++; rr%=(r); } } for(int i=0;i<aa;i++) { bs[i]++; col[pos[i]]=i; } for(int i=1;i<=n;i++) { if(bs[col[i]]==1) { if(num[i]!=r-1)p=false; } else { if(num[i]!=r)p=false; } } } else { for(int i=1;i<=n;i++) { bs[rr]++; col[i]=rr; rr++; rr%=(r); } for(int i=1;i<=n;i++) { if(bs[col[i]]==1) { if(num[i]!=r-1)p=false; } else { if(num[i]!=r)p=false; } } } return p; } int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&num[i]); mk=max(num[i],mk); ss+=num[i]; } for(int i=1;i<=n;i++) { if(num[i]<mk)cc++,pos.push_back(i),bi[i]=true; if(num[i]<mk-1)pp=false; } if(ch(mk)) { printf("Yes"); } else { if(ch(mk+1)) { printf("Yes"); } else { printf("No"); } } }
a.cc:7:1: error: expected initializer before 'bool' 7 | bool ch(int mm) | ^~~~ a.cc: In function 'int main()': a.cc:78:35: error: 'pos' was not declared in this scope; did you mean 'pow'? 78 | if(num[i]<mk)cc++,pos.push_back(i),bi[i]=true; | ^~~ | pow a.cc:81:12: error: 'ch' was not declared in this scope; did you mean 'cc'? 81 | if(ch(mk)) | ^~ | cc
s558063328
p03688
C++
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) cin >> A[i]; int amax, amin; amax = *max_element(A.begin(), A.end()); amin = *min_element(A.begin(), A.end()); //cout << amax << " " << amin << '\n'; if (amax - amin > 1) cout << "No" << '\n'; else{ if (amax == amin){ if (amax == N-1 or 2 * amax <= N) cout << "Yes" << '\n'; else cout << "No" << '\n'; } else { vector<int> D(amax); int alone, not_alone = 0, 0; for (int i = 0; i < N; i++){ if (A[i] == amin) alone += 1; else not_alone += 1; } if (alone < amax and 2 * (amax - alone) <= not_alone) cout << "Yes" << '\n'; else cout << "No" << '\n'; } } return 0; }
a.cc: In function 'int main()': a.cc:26:39: error: expected unqualified-id before numeric constant 26 | int alone, not_alone = 0, 0; | ^
s438771572
p03688
C++
`#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)(n);++i) #define rep1(i,n) for(int i=1;i<=(int)(n);++i) #define rep11(i,n) for(int i=1;i<(int)(n);++i) #define repo(i,o,n) for(int i=o;i<(int)(n);++i) #define repm(i,n) for(int i=(int)(n)-1;i>=0;--i) #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define sperase(v,n) (v).erase(remove(all(v), n), (v).end()) #define vdelete(v) (v).erase(unique(all(v)), (v).end()) #define pb(n) push_back(n) #define mp make_pair #define MOD 1000000007 #define INF LONG_LONG_MAX int n,a,r1,r2,cnt1=1,cnt2; signed main() { cin >> n >> r1, r2 = r1+1; rep(i,n-1) { cin >> a; if (r1 == a) cnt1++; else if (r2 == a) cnt2++; else { cout << "No" << endl; return 0; } } if (!cnt2) { if (n-1 == r1 || r1*2 <= n) cout << "Yes" << endl; else cout << "No" << endl; } else { n -= cnt1; r2 -= cnt1; if (n == r2 || r2*2 <= n) cout << "Yes" << endl; else 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: In function 'int main()': a.cc:24:5: error: 'cin' was not declared in this scope 24 | cin >> n >> r1, r2 = r1+1; | ^~~ a.cc:30:13: error: 'cout' was not declared in this scope 30 | cout << "No" << endl; | ^~~~ a.cc:30:29: error: 'endl' was not declared in this scope 30 | cout << "No" << endl; | ^~~~ a.cc:35:37: error: 'cout' was not declared in this scope 35 | if (n-1 == r1 || r1*2 <= n) cout << "Yes" << endl; | ^~~~ a.cc:35:54: error: 'endl' was not declared in this scope 35 | if (n-1 == r1 || r1*2 <= n) cout << "Yes" << endl; | ^~~~ a.cc:36:14: error: 'cout' was not declared in this scope 36 | else cout << "No" << endl; | ^~~~ a.cc:36:30: error: 'endl' was not declared in this scope 36 | else cout << "No" << endl; | ^~~~ a.cc:40:35: error: 'cout' was not declared in this scope 40 | if (n == r2 || r2*2 <= n) cout << "Yes" << endl; | ^~~~ a.cc:40:52: error: 'endl' was not declared in this scope 40 | if (n == r2 || r2*2 <= n) cout << "Yes" << endl; | ^~~~ a.cc:41:14: error: 'cout' was not declared in this scope 41 | else cout << "No" << endl; | ^~~~ a.cc:41:30: error: 'endl' was not declared in this scope 41 | else cout << "No" << endl; | ^~~~
s900711433
p03688
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define REPP(i,n) for(int i=1;i<=n;i++) const double PI = acos(-1); const double EPS = 1e-15; long long INF=(long long)1E17; #define i_7 (long long)(1E9+7) long mod(long a){ long long c=a%i_7; if(c>=0)return c; return c+i_7; } using namespace std; bool prime_(int n){ if(n==1){ return false; }else if(n==2){ return true; }else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } } long long gcd_(long long a, long long b){ if(a<b){ swap(a,b); } if(a%b==0){ return b; }else{ return gcd_(b,a%b); } } long long lcm_(long long x, long long y){ return (x/gcd_(x,y))*y; } class UnionFind { public: //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。 vector<int> Parent; //クラスを作るときは、Parentの値を全て-1にする。 //以下のようにすると全てバラバラの頂点として解釈できる。 UnionFind(int N) { Parent = vector<int>(N, -1); } //Aがどのグループに属しているか調べる int root(int A) { if (Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } //自分のいるグループの頂点数を調べる int size(int A) { return -Parent[root(A)];//先祖をrootで取っておきたい。 } //AとBをくっ付ける bool connect(int A, int B) { //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける A = root(A); B = root(B); if (A == B) { //すでにくっついてるからくっ付けない return false; } //大きい方(A)に小さいほう(B)をくっ付けたい //大小が逆だったらAとBをひっくり返す。 if (size(A) < size(B)) swap(A, B); //Aのサイズを更新する Parent[A] += Parent[B]; //Bの親をAに変更する Parent[B] = A; return true; } }; int main(){ int n; cin>>n; int a[n]; int min_v=100'000; int max_v=0; REP(i,n){ cin>>a[i]; min_v = min(min_v, a[i]); max_v = max(max_v, a[i]); } if(max_v-min_v>1){ cout<<"No"<<endl; return 0; } //max_v-min_vは、0か1 if(max_v==min_v){ if(1<=max_v && max<=n/2){ cout<<"Yes"<<endl; }else if(max_v==n-1){ cout<<"Yes"<<endl; }else{ cout<<"No"<<endl; } return 0; } //以下max_v-min_vは、1 int p=0;//唯一の色の帽子をかぶっている猫の数 int q; REP(i,n){ if(a[i]==min_v){ p++; } } q = max_v - p; if(n-p>=2*q){ cout<<"Yes"<<endl; }else{ cout<<"No"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:107:23: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<=' 107 | if(1<=max_v && max<=n/2){ | ~~~^~~~~
s389112416
p03688
C++
#include<iostream> #include<string> #include<cstdio> #include <cstring> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> using namespace std; typedef long long ll; typedef unsigned int ui; const ll mod = 1000000007; typedef long double ld; const ll INF = 1e+14; typedef pair<int, int> P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; #define fr first #define sc second #define all(c) c.begin(),c.end() #define pb push_back void Yes(){ cout<<"Yes"<<endl; exit(0); } void No(){ cout<<"No"<<endl; exit(0); } int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; int a[100100]; map<int, int> mp; rep(i, N) { cin >> a[i]; mp[a[i]] ++; } if(mp.size() != 1 && mp.size() != 2) No(); else if(mp.size() == 1) { if(a[0] == N - 1) Yes(); else if(a[0] * 2 <= N) Yes(); else No(); } else { int m[2]; int i = 0; for(auto mp : p) { m[i] = p.fr; i++; } if(abs(m[0] - m[1]) > 1) No(); else { int k = max(m[0], m[1]); if(mp[k - 1] <= k - 1 && mp[k] >= 2) Yes(); else No(); } } return 0; }
a.cc: In function 'int main()': a.cc:72:23: error: 'p' was not declared in this scope 72 | for(auto mp : p) { | ^
s545747194
p03688
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) using namespace std; typedef long long int ll; typedef pair<int,int> P; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; #define dame { puts("-1"); return 0;} #define yn {puts("Yes");}else{puts("No");} int main() { int n; cin >> n; int a[n]; int flag = 0; rep(i,n)cin >> a[i]; sort(a,a+n); if(a[0]==a[n-1]){ if(a[0]==n-1)flag=1; if(a[0] <= n/2)flag=1; } if(a[0]+1 == a[n-1]){ int count = 0; rep(i,n){ if(a[i] == a[0])count++; } int k = a[n-1]; n -= count; k -= count; if(a[0]<count)break; if(k <= n/2)flag = 1; } if(flag>0)yn; return 0; }
a.cc: In function 'int main()': a.cc:35:23: error: break statement not within loop or switch 35 | if(a[0]<count)break; | ^~~~~
s638577464
p03688
C++
#include<bits/stdc++.h> using namespace std; int n,a[1000005]; int main() { n=read(); int mn=n+1,mx=0; for(int i=1;i<=n;i++) { a[i]=read(); mn=min(mn,a[i]); mx=max(mx,a[i]); } if(mx>mn+1){puts("No");return 0;} if(mx==mn) { if(mn==n-1){puts("Yes");return 0;} if(2*mn<=n){puts("Yes");return 0;} puts("No");return 0; } else { int cnt=0; for(int i=1;i<=n;i++)cnt+=(a[i]==mn); if(mn<cnt){puts("No");return 0;} if(n-cnt<2*(mx-cnt)){puts("No");return 0;} else{puts("Yes");return 0;} } return 0; }
a.cc: In function 'int main()': a.cc:6:11: error: too few arguments to function 'ssize_t read(int, void*, size_t)' 6 | n=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:10:18: error: too few arguments to function 'ssize_t read(int, void*, size_t)' 10 | a[i]=read(); | ~~~~^~ /usr/include/unistd.h:371:16: note: declared here 371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur | ^~~~
s102243446
p03688
C++
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> using namespace std; typedef long long ll; typedef unsigned int ui; const ll mod = 1000000007; typedef long double ld; const ll INF = 1e+14; typedef pair<int, int> P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; #define fr first #define sc second int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; int a = 0, b = 0, cnta = 0, cntb = 0; rep(i, N) { int x; cin >> x; if(a == 0) { a = x; cnta ++; continue; } if(x == a) { cnta ++; continue; } if(x != a) { if(b == 0) { b = x; cntb ++; continue; } if(x == b) { cntb ++; continue; } if(x != b) { cout << "No\n"; return 0; } } } map<int, int> mp; mp[a] = cnta; mp[b] = cntb; if(b == 0) { if(N / 2 >= a || a = N - 1) { cout << "Yes\n"; return 0; } else { cout << "No\n"; return 0; } } else { if(abs(a - b) != 1) { cout << "No\n"; return 0; } else { int y = min(a, b), z = max(a, b); N -= mp[y]; z -= mp[y]; if(N / 2 >= z ) { cout << "Yes\n"; return 0; } else { cout << "No\n"; return 0; } } } return 0; }
a.cc: In function 'int main()': a.cc:77:21: error: lvalue required as left operand of assignment 77 | if(N / 2 >= a || a = N - 1) { | ~~~~~~~~~~~^~~~
s416358793
p03688
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N;cin>>N; map<int, int> table; for (int i=0;i<N;++i){ int a;cin>>a;table[a]++; } if(table.size()>2) {cout << "No" << endl;return 0;} vector<pair<int, iny>> v; for (auto p:table){ int k=p.first;int l=p.second; pair<int, int> q=make_pair(k,l); v.push_back(q); } if(table.size()==1){ if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;} cout << "No" << endl; return 0; } sort(v.begin(), v.end()); int k=v[1].first, j=v[0].second; if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;} cout << "No" << endl;return 0; }
a.cc: In function 'int main()': a.cc:12:20: error: 'iny' was not declared in this scope; did you mean 'int'? 12 | vector<pair<int, iny>> v; | ^~~ | int a.cc:12:20: error: template argument 2 is invalid a.cc:12:23: error: template argument 1 is invalid 12 | vector<pair<int, iny>> v; | ^~ a.cc:12:23: error: template argument 2 is invalid a.cc:16:7: error: request for member 'push_back' in 'v', which is of non-class type 'int' 16 | v.push_back(q); | ^~~~~~~~~ a.cc:20:9: error: invalid types 'int[int]' for array subscript 20 | if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;} | ^ a.cc:20:26: error: invalid types 'int[int]' for array subscript 20 | if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;} | ^ a.cc:24:10: error: request for member 'begin' in 'v', which is of non-class type 'int' 24 | sort(v.begin(), v.end()); | ^~~~~ a.cc:24:21: error: request for member 'end' in 'v', which is of non-class type 'int' 24 | sort(v.begin(), v.end()); | ^~~ a.cc:26:10: error: invalid types 'int[int]' for array subscript 26 | int k=v[1].first, j=v[0].second; | ^ a.cc:27:11: error: 'j' was not declared in this scope 27 | if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;} | ^
s285472122
p03688
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N;cin>>N; map<int, int> table; for (int i=0;i<N;++i){ int a;cin>>a;table[a]++; } if(table.size()>2) {cout << "No" << endl;return 0;} vector<int> v; for (auto p:table){ int k=p.first;int l=p.second; pair<int, int> q=make_pair(k,l); v.push_back(q); } if(table.size()==1){ if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;} cout << "No" << endl; return 0; } sort(v.begin(), v.end()); int k=v[1].first, j=v[0].second; if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;} cout << "No" << endl;return 0; }
a.cc: In function 'int main()': a.cc:16:16: error: no matching function for call to 'std::vector<int>::push_back(std::pair<int, int>&)' 16 | v.push_back(q); | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<int>::value_type&' {aka 'const int&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::value_type&&' {aka 'int&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:20:13: error: request for member 'first' in 'v.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 20 | if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;} | ^~~~~ a.cc:20:30: error: request for member 'first' in 'v.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 20 | if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;} | ^~~~~ a.cc:26:14: error: request for member 'first' in 'v.std::vector<int>::operator[](1)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 26 | int k=v[1].first, j=v[0].second; | ^~~~~ a.cc:27:11: error: 'j' was not declared in this scope 27 | if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;} | ^
s145249889
p03688
C++
#include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=50005; int a[100005],n; int main() { scanf("%d",&n); int mx=0; int mn=0x3f3f3f3f; for(int i=0;i<n;i++) { scanf("%d",&a[i]); mx=max(mx,a[i]); mn=min(mn,a[i]); } if(mx-1>mn) { printf("No\n"); return 0; } if(mx==mn) { if(mn==n-1) { printf("Yes\n"); return 0; } if(2*mn<=n) { printf("Yes\n"); return 0; } else { printf("No\n"); return 0; } } else { int ant=0; for(int i=0;i<n;i++) { if(a[i]==mn) ant++; } if(mn<ant) { printf("No\n"); return 0; } if(n-ant<2*(mx-ant)) { pritnf("No\n"); return 0; } else { printf("Yes\n"); return 0; } } }
a.cc: In function 'int main()': a.cc:55:13: error: 'pritnf' was not declared in this scope; did you mean 'printf'? 55 | pritnf("No\n"); | ^~~~~~ | printf
s803585859
p03688
C++
#include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=50005; int a[100005],n; int main() { scanf("%d",&n); int mx=0; int mn=0x3f3f3f3f; for(int i=0;i<n;i++) { scanf("%d",&a[i]); mx=max(mx,a[i]); mn=min(mn,a[i]); } if(mx-1>mn) { printf("No\n"); return 0; } if(mx==mn) { if(mn==n-1) { printf("Yes\n"); return 0; } if(2*mn<=n) { printf("Yes\n"); return 0; } else { printf("No\n"); return 0; } } else { int ant=0; for(int i=0;i<n;i++) { if(a[i]==mn) ant++; } if(mn<cnt) { printf("No\n"); return 0; } if(n-cnt<2*(mx-cnt)) { pritnf("No\n"); return 0; } else { printf("Yes\n"); return 0; } } }
a.cc: In function 'int main()': a.cc:48:15: error: 'cnt' was not declared in this scope; did you mean 'ant'? 48 | if(mn<cnt) | ^~~ | ant a.cc:53:14: error: 'cnt' was not declared in this scope; did you mean 'ant'? 53 | if(n-cnt<2*(mx-cnt)) | ^~~ | ant a.cc:55:13: error: 'pritnf' was not declared in this scope; did you mean 'printf'? 55 | pritnf("No\n"); | ^~~~~~ | printf
s350137055
p03688
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) const int mod=1000000007; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n;cin >> n; vector<int> a(n); rep(i,n) cin >> a.at(i); sort(a.begin(),a.end()); if(a.at(n-1)-a.at(0)>1) cout << "No" << endl; else{ if(a.at(n-1)-a.at(0)==0){ if(a.at(0)*2<=n || a.at(0)==n-1 || cnt==a.at(0)) cout << "Yes" << endl; else cout << "No" << endl; } else{ int cnt=0; rep(i,n) if(a.at(i)==a.at(0)) cnt++; if(cnt<a.at(n-1) && 2*(a.at(n-1)-cnt)<=n-cnt) cout << "Yes" << endl; else cout << "No" << endl; } } }
a.cc: In function 'int main()': a.cc:20:60: error: 'cnt' was not declared in this scope; did you mean 'int'? 20 | if(a.at(0)*2<=n || a.at(0)==n-1 || cnt==a.at(0)) cout << "Yes" << endl; | ^~~ | int
s212146750
p03688
C++
#include <bits/stdc++.h> typedef long long ll; typedef long double ld; const int INF=1e9,MOD=1e9+7,ohara=1e6+10; const ll LINF=1e18; using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define rrep(i,a,b) for(int i=(a);i<(b);i++) #define rrrep(i,a,b) for(int i=(a);i>=(b);i--) #define all(v) (v).begin(), (v).end() #define Size(n) (n).size() #define Cout(x) cout<<(x)<<endl #define Cerr(x) cerr<<(x)<<endl #define fi first #define se second ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k; ld doua; int dy[]={1,0,-1,0}; int dx[]={0,1,0,-1}; //int dy[]={-1,0,1,-1,1,-1,0,1}; //int dx[]={-1,-1,-1,0,0,1,1,1}; string alph("abcdefghijklmnopqrstuvwxyz"),s; bool fl; struct edge{int to,cost;}; //-------------------------↓↓↓↓↓↓------------------------ int main(void){ cin.tie(0); ios::sync_with_stdio(false); cin>>n; rep(i,n)cin>>a[i]; if((*max_element(a,a+n))-(*min_element(a,a+n))>=2)Cout("No"); else{ if((*max_element(a,a+n))-(*min_element(a,a+n))==0){ if(a[0]==n-1)Cout("Yes"); else{ if(a[i]*2<=n)Cout("Yes"); else Cout("No"); } } else{ c=1; assert(c==0); } } return 0; }
a.cc: In function 'int main()': a.cc:41:22: error: 'i' was not declared in this scope 41 | if(a[i]*2<=n)Cout("Yes"); | ^
s232545941
p03688
C
#include<stdio.h> int main() { int max=0, min=1000000,maxnum=0,minnum=0; int n; int s[100005]; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &s[i]); if (max < s[i])max = s[i]; if (min > s[i])min = s[i]; } if (max - min >= 2) { printf("No"); return 0; } if(max==min&&n<2*max) { printf("No"); return 0; }else if(max == min && n >=2 * max){ printf("Yes"); return 0; } for (int i = 0; i < n; i++) { if (max == s[i])maxnum++; if (min == s[i])minnum++; } if (n - maxnum + 1 <= max && max <= n - maxnum + maxnum / 2) { printf("Yes"); return 0; } else { printf("Yes") } }
main.c: In function 'main': main.c:21:30: error: expected ';' before '}' token 21 | printf("Yes") | ^ | ; 22 | } | ~
s227029362
p03688
C++
#include<bits/stdc++.h> using namespace std; int maxx=0,minx=100025,c1=0,c2=0,n,x; int max(int a,int b) { if (a>b) return a; } int min(int a,int b) { if (a<b) return a; } int main() { scanf("%d",&n); for (int i=1;i<=n;i++) { scanf("%d",&x); if (maxx=x) {c1++;continue;} if (minx=x) {c2++;continue;} maxx=max(x,maxx);minx=min(x,minx); if (maxx=x) c1=1; if (minx=x) c2=1; } if (maxx-minx>1) cout<<"No"; else if (maxx=minx&&c2=n||c2*2<=n) cout<<"Yes"; else if (maxx=minx+1&&(minx<c2||(maxx-c2)*2>n-c2)) cout<<"Yes"; else cout<<"No"; return 0; }
a.cc: In function 'int main()': a.cc:30:35: error: lvalue required as left operand of assignment 30 | else if (maxx=minx&&c2=n||c2*2<=n) cout<<"Yes"; | ~~~~^~~~ a.cc: In function 'int max(int, int)': a.cc:11:1: warning: control reaches end of non-void function [-Wreturn-type] 11 | } | ^ a.cc: In function 'int min(int, int)': a.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type] 15 | } | ^
s391247659
p03688
C++
#include "bits/stdc++.h" using namespace std; using ll = long long; using vll = vector<ll>; using pl4 = pair<ll,ll>; using str = string; #define llin(x) ll (x);cin >>(x); #define stin(x) str (x);cin >>(x); #define sz size() #define be begin() #define en end() #define fi first #define se second #define FOR(i,a,b) for(ll i = a ; i <= b ; i++) #define rFOR(i,b,a) for(ll i = a; i >= b ; i--) #define SORT(x) sort(x.be, x.en) #define sal(x) cout<<(x)<<endl; #define yn(a) cout <<((a)?"yes":"no")<<endl; #define Yn(a) cout <<((a)?"Yes":"No")<<endl; #define YN(a) cout <<((a)?"YES":"NO")<<endl; #define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl; #define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl; signed main(){ llin(n); pl4 p,q; p.se=1; q.se=1; q.fi=-1; ll k; cin>>p.fi; FOR(i,1,n-1){ cin>>k; if(k==p.fi){ p.se++; }else if(k==q.fi){ q.se++; }else if(q.fi==-1){ q.fi=k; if(abs(p.fi-q.fi)!=1){ sal("No"); return 0; } }else{ sal("No"); return 0; } } if (q.fi==-1){ sal((p.fi+1==p.se | p.fi=<p.se/2)?"Yes":"No"); return 0; } pl4 b=((p>q)?p:q); pl4 s=((p>q)?q:p); sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No"); }
a.cc: In function 'int main()': a.cc:53:34: error: expected primary-expression before '<' token 53 | sal((p.fi+1==p.se | p.fi=<p.se/2)?"Yes":"No"); | ^ a.cc:20:23: note: in definition of macro 'sal' 20 | #define sal(x) cout<<(x)<<endl; | ^
s492412380
p03688
C++
#include "bits/stdc++.h" using namespace std; using ll = long long; using vll = vector<ll>; using pl4 = pair<ll,ll>; using str = string; #define llin(x) ll (x);cin >>(x); #define stin(x) str (x);cin >>(x); #define sz size() #define be begin() #define en end() #define fi first #define se second #define FOR(i,a,b) for(ll i = a ; i <= b ; i++) #define rFOR(i,b,a) for(ll i = a; i >= b ; i--) #define SORT(x) sort(x.be, x.en) #define sal(x) cout<<(x)<<endl; signed main(){ llin(n); pl4 p,q; p.se=0; q.se=0; ll k; cin>>p.fi; FOR(i,1,n-1){ cin>>k; if(k==p.fi){ p.se++; }else if(k==q.fi){ q.se++; }else if(q.fi==-1){ q.fi=k; q.se++; if(abs(p.fi-q.fi)!=1){ sal("No"); return 0; } }else{ sal("No"); return 0; } } if (q.fi=-1){ sal((s.fi+1==s.se)?"Yes":"No"); return 0; } pl4 b=((p>q)?p:q); pl4 s=((p>q)?q:p); sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No"); }
a.cc: In function 'int main()': a.cc:48:14: error: 's' was not declared in this scope 48 | sal((s.fi+1==s.se)?"Yes":"No"); | ^ a.cc:20:23: note: in definition of macro 'sal' 20 | #define sal(x) cout<<(x)<<endl; | ^
s643810282
p03688
C++
#include "bits/stdc++.h" using namespace std; using ll = long long; using vll = vector<ll>; using pl4 = pair<ll,ll>; using str = string; #define llin(x) ll (x);cin >>(x); #define stin(x) str (x);cin >>(x); #define sz size() #define be begin() #define en end() #define fi first #define se second #define FOR(i,a,b) for(ll i = a ; i <= b ; i++) #define rFOR(i,b,a) for(ll i = a; i >= b ; i--) #define SORT(x) sort(x.be, x.en) #define sal(x) cout<<x<<endl signed main(){ llin(n); pl4 p,q; p.se=0; q.se=0; ll k; cin>>p.fi; FOR(i,1,n-1){ cin>>k; if(k==p.fi){ p.se++; }else if(k==q.fi){ q.se++; }else if(q.fi==-1){ q.fi=k; q.se++; if(abs(p.fi-q.fi)!=1){ sal("No"); return 0; } }else{ sal("No"); return 0; } } pl4 b=((p>q)?p:q); pl4 s=((p>q)?q:p); sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No"); }
a.cc: In function 'int main()': a.cc:20:23: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<' 20 | #define sal(x) cout<<x<<endl | ^ a.cc:49:5: note: in expansion of macro 'sal' 49 | sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No"); | ^~~
s763881633
p03688
C++
#include<cstdio> #include<iostream> #define fi(s) freopen(s,"r",stdin); #define fo(s) freopen(s,"w",stdout); using namespace std; typedef long long ll; const int N = 1000000 + 5; ll read() { ll x = 0,f = 1;char c = getchar(); while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar(); } while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x * f; } int a[N]; int Min,Max,Minjs,Maxjs;a int main() { int n = read(); Min = N; Max = -1; Minjs = Maxjs = 0; for(int i = 1;i <= n;++i) { a[i] = read(); Min = min(Min,a[i]); Max = max(Max,a[i]); } if(Max - Min > 1) { puts("No");continue; } if(Min == Max) { if(Min + 1 == n || Min <= (n>>1)) puts("Yes"); else puts("No"); continue; } for(int i = 1;i <= n;++i) { if(a[i] == Min) Minjs++; if(a[i] == Max) Maxjs++; } if(Max <= Minjs) { puts("No");continue; } Max -= Minjs; if(Max > (Maxjs >> 1) ) { puts("No"); continue; } puts("Yes"); return 0; }
a.cc:21:25: error: 'a' does not name a type 21 | int Min,Max,Minjs,Maxjs;a | ^
s129307030
p03688
C++
#include<complex> #include<cstdio> using namespace std; const int N=1e6+7; int n,minn=0x3f3f3f3f,maxn; int a[N]; int qread() { int x=0; char ch=getchar(); while(ch<'0' || ch>'9')ch=getchar(); while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();} return x; } int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { a[i]=qread(); maxn=max(maxn,a[i]); minn=min(minn,a[i]); } if(maxn-minn>=2){puts("Yes");continue;} if(maxn==minn && maxn==n-1){puts("No");continue;} int cnt1=0,cnt2=0; for(int i=1;i<=n;i++) if(a[i]==maxn-1)cnt1++; else cnt2++; int p=maxn-cnt1; if(p*2>cnt2 || p<=0)puts("Yes"); else puts("No"); return 0; }
a.cc: In function 'int main()': a.cc:24:38: error: continue statement not within a loop 24 | if(maxn-minn>=2){puts("Yes");continue;} | ^~~~~~~~ a.cc:25:48: error: continue statement not within a loop 25 | if(maxn==minn && maxn==n-1){puts("No");continue;} | ^~~~~~~~
s272907327
p03688
C++
#include<iostream> #include<ctype.h> #include<cstdio> #include<algorithm> using namespace std; inline int read(){ int x=0,f=0;char ch=getchar(); while(!isdigit(ch))f|=ch=='-',ch=getchar(); while(isdigit(ch))x=x*10+(ch^48),ch=getchar(); return f?-x:x; } int a[1000007]; int main(){ // freopen("hat.in","r",stdin); // freopen("hat.out","w",stdout); // int T=read(); // while(T--){ int n=read(),maxn=0,x=0,y=0,minn=99999999; for(int i=1;i<=n;++i){ a[i]=read(); maxn=max(maxn,a[i]); minn=min(minn,a[i]); } if(maxn-minn>1){printf("No\n");return 0;} for(int i=1;i<=n;++i)if(a[i]==minn)++x;else ++y; if(maxn==minn){ if(x==n-1 || x+x<=n)printf("No\n") else printf("Yes\n");return 0; } if(n-x>maxn+maxn-x-x){printf("No\n");return 0;} printf("Yes\n"); // } // fclose(stdin);fclose(stdout); return 0; }
a.cc: In function 'int main()': a.cc:27:55: error: expected ';' before 'else' 27 | if(x==n-1 || x+x<=n)printf("No\n") | ^ | ; 28 | else printf("Yes\n");return 0; | ~~~~
s107884861
p03688
C++
#include <queue> #include <cstdio> #include <cctype> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int maxn = 1000000 + 10; int n, maxx, minn, a[maxn]; int main(int argc, char const *argv[]) { scanf("%d", &n), maxx = 0, minn = 1e9; for(int i = 1; i <= n; ++i) scanf("%d", &a[i]), maxx = max(maxx, a[i]), minn = min(minn, a[i]); if( maxx - minn > 1 ) { printf("No\n"); continue; } else if( maxx - minn == 0 ) { if( 2 * maxx <= n || minn == n - 1 ) printf("Yes\n"); else printf("No\n"); } else if( maxx - minn == 1 ) { int col = 0, x = 0, max_col, min_col, flag = 1; for(int i = 1; i <= n; ++i) a[i] == maxx ? ++x : ++col; min_col = col + 1, max_col = col + (x >> 1); // printf("%d %d\n", max_col, min_col); if( min_col > n && max_col < 1 ) flag = flag & 0; if( minn + 1 > max_col || minn + 1 < min_col ) flag = flag & 0; if( maxx > max_col || maxx < min_col ) flag = flag & 0; printf(!flag ? "No\n" : "Yes\n"); } return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:18:21: error: continue statement not within a loop 18 | printf("No\n"); continue; | ^~~~~~~~
s702416313
p03688
C++
/* mdzz I once provide a more difficult problem frome this question consider some obervise facts let's define 'mx' is the max number and 'mn' is the min number, 'num' is the number of 'mn' if mx > mn + 1 there is no solution if mn = mn there should be two stuaiton first, all color are different, and num = N - 1 second, all color happen morn than twice , so 2 * mn <= N if mx == mn + 1 , it's also very easy, there still have a obervise fact it's says that: all of the mn color are different and the mx color happen at least twice so we should judge two parts: first : 2 * (mx - num) <= (N - num) second : mx - num > 0 if you are interested in this problem, you can think that if there are some people don't say anythings, how shold we judge. */ #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int MAXN = 1e5 + 10, INF = 1e9 + 10; inline int read() { char c = getchar(); int x = 0, f = 1; while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();} while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); return x * f; } int T, N, a[MAXN], mn, mx, num, flag; int main() { N = read(); for(int i = 1; i <= N; i++) a[i] = read(); mn = -1, mx = -1; num = 0; flag = 0; for(int i = 1; i <= N; i++) { if(mn == -1) mn = a[i], num = 1; else if(a[i] == mn) num++; else if(a[i] != mn && ((mx == -1) || (a[i] == mx))) mx = a[i]; else flag = 1; } if(flag == 1) {puts("Yes");continue;} if(mx == -1) mx = mn; if(mn > mx) swap(mn, mx), num = N - num; if(mx > mn + 1) {puts("Yes"); continue;} if(mn == mx) { if(mn == N - 1) puts("No"); else if(2 * mn <= N && ((mn != 0) || (mn == 0 && N == 1))) puts("No"); else puts("Yes"); } else { if((2 * (mx - num) <= (N - num)) && (mx > num)) puts("No"); else puts("Yes"); } return 0; } /* 3 3 1 2 2 3 1 1 2 5 4 3 4 3 4 1 5 2 3 1 1 4 5 2 2 3 3 3 Yes 1 2 4 4 4 1 0 6 3 1 2 2 3 1 1 2 5 4 3 4 3 4 5 2 2 3 3 3 1 0 5 0 0 0 0 0 1 // N Y Y N N */
a.cc: In function 'int main()': a.cc:53:44: error: continue statement not within a loop 53 | if(flag == 1) {puts("Yes");continue;} | ^~~~~~~~ a.cc:59:47: error: continue statement not within a loop 59 | if(mx > mn + 1) {puts("Yes"); continue;} | ^~~~~~~~
s742505422
p03688
C
using System; using System.Linq;//リストの使用 using System.Collections.Generic; class Program { static void Main() { long n = long.Parse(Console.ReadLine()); long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse); long maxNum = nums.Max(); long minNum = nums.Min(); long minCount = 0;//小さい数の猫の数 long maxCount = 0; for(long i = 0; i < n; i++) { if(nums[i] == minNum) minCount++; } maxCount = n - minCount; if(maxNum - minNum >= 2) Console.WriteLine("No"); else if(maxNum - minNum == 0) { if(maxNum == 1 || maxNum == n-1) Console.WriteLine("Yes"); else Console.WriteLine("No"); }else if(maxNum - minNum == 1) { if(maxCount == 1) Console.WriteLine("No"); else if(minCount+1 <= maxNum && maxNum <= minCount + (maxCount/2)) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } }
main.c:1:1: error: unknown type name 'using' 1 | using System; | ^~~~~ main.c:2:1: error: unknown type name 'using' 2 | using System.Linq;//リストの使用 | ^~~~~ main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | using System.Linq;//リストの使用 | ^ main.c:3:1: error: unknown type name 'using' 3 | using System.Collections.Generic; | ^~~~~ main.c:3:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 3 | using System.Collections.Generic; | ^ main.c:4:1: error: unknown type name 'class' 4 | class Program | ^~~~~ main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 5 | { | ^
s229802547
p03688
C++
/* 对于一个来说最多只能去掉一种颜色 所以每个a之间差不能超过1 */ #include<map> #include<vector> #include<cstdio> #include<cstring> #include<algorithm> #define gc getchar() #define pc putchar #define LL long long inline int read() { int x = 0,f = 1; char c = gc; while(c < '0' || c > '9')c = gc; while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = gc; return x * f; } void print(int x) { if(x < 0) { pc('-'); x = -x; } if(x >= 10) print(x / 10); pc(x % 10 + '0'); } int main() { int n = read(); int mn = n + 1,mx = -1; for(int q,i = 1;i <= n;++ i) mn = std::min(mn,a),mx = std::max(mx,a); if(mx - mn > 1) { puts("Yes"); } else puts("No"); }
a.cc: In function 'int main()': a.cc:32:55: error: 'a' was not declared in this scope 32 | for(int q,i = 1;i <= n;++ i) mn = std::min(mn,a),mx = std::max(mx,a); | ^
s287349055
p03688
C++
#include <bits/stdc++.h> #define int long long using namespace std; int a[100001]; main () { ios_base::sync_with_stdio (0); cin.tie (0), cout.tie (0); int n; cin >> n; int kol = 0; int mn = n; int mx = 0; for (int i = 1;i <= n;i ++) { cin >> a[i]; mn = min (mn, a[i]); mx = max (mx, a[i]); } if (mx > n - 1) { cout << "No"; return 0; } int kol1 = 0; for (int i = 1;i <= n;i ++) { if (a[i] == mn) kol1 ++; } int kol2 = n - kol1; if (mx - mn > 1) { cout << "No"; return 0; } if (mx == mn) { if (mx == n - 1) { cout << "Yes"; return 0; } if (n / mx > 1) { cout << "Yes"; } else cout << "No"; } else { if (mn == 1) { if (kol1 > 1) { cout << "No"; return 0; } } if ((kol1 - 1) + kol2 / 2 >= mn && kol1 + kol2 / 2 >= mx) { cout << "Yes"; } else cout < "No"; } return 0; }
a.cc:9:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 9 | main () { | ^~~~ a.cc: In function 'int main()': a.cc:55:27: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [3]') 55 | else cout < "No"; | ~~~~ ^ ~~~~ | | | | | const char [3] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:55:29: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [3]' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:55:29: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [3]' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 55 | else cout < "No"; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 55 | else cout < "No"; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:55:29: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits
s790709162
p03688
C++
#include <bits/stdc++.h> #define int long long using namespace std; int a[100001]; main () { ios_base::sync_with_stdio (0); cin.tie (0), cout.tie (0); int n; cin >> n; int kol = 0; int mn = n; int mx = 0; for (int i = 1;i <= n;i ++) { cin >> a[i]; mn = min (mn, a[i]); mx = max (mx, a[i]); } if (mx > n - 1) { cout << "No"; return 0; } int kol1 = 0; for (int i = 1;i <= n;i ++) { if (a[i] == mn) kol1 ++; } int kol2 = n - kol1; if (mx - mn > 1) { cout << "No"; return 0; } if (mx == mn) { if (mx == n - 1) { cout << "Yes"; return 0; } if (n / mx > 1) { cout << "Yes"; } else cout << "No"; } else { if (mn == 1) { if (kol1 > 1) { cout << "No"; return 0; } } if ((kol1 - 1) + kol2 / 2 >= mn && kol1 + kol2 / 2 >= mx) { cout << "Yes"; } else cout < "No"; } return 0; }
a.cc:9:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 9 | main () { | ^~~~ a.cc: In function 'int main()': a.cc:55:27: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [3]') 55 | else cout < "No"; | ~~~~ ^ ~~~~ | | | | | const char [3] | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:55:29: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [3]' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:55:29: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [3]' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else cout < "No"; | ^~~~ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 55 | else cout < "No"; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 55 | else cout < "No"; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:55:29: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:55:29: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*' 55 | else cout < "No"; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits
s165688115
p03688
C++
#include <bits/stdc++.h> using namespace std; #define int long long const double PI = 3.14159265358979323846; typedef vector<int> vint; typedef pair<int, int> pint; int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int N; int a[110000]; signed main() { cin >> N; for (int i = 0; i < N; i++) cin >> a[i]; sort(a, a + N); if (a[0] == a[N - 1]) { if (a[0] + 1 == N || a[0] * 2 <= N)cout << "Yes" << endl; else cout << "No" << endl; return 0; } if (a[0] + 1 != a[N - 1]) { else cout << "No" << endl; return 0; } int n = 0; for (int i = 0; i < N - 1; i++) { if (a[i] == a[0]) {a[N - 1]--; n++;} } if (a[0] > n && a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl; else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:25:9: error: expected '}' before 'else' 25 | else cout << "No" << endl; | ^~~~ a.cc:24:31: note: to match this '{' 24 | if (a[0] + 1 != a[N - 1]) { | ^ a.cc: At global scope: a.cc:30:5: error: expected unqualified-id before 'for' 30 | for (int i = 0; i < N - 1; i++) { | ^~~ a.cc:30:21: error: 'i' does not name a type 30 | for (int i = 0; i < N - 1; i++) { | ^ a.cc:30:32: error: 'i' does not name a type 30 | for (int i = 0; i < N - 1; i++) { | ^ a.cc:34:5: error: expected unqualified-id before 'if' 34 | if (a[0] > n && a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl; | ^~ a.cc:35:5: error: expected unqualified-id before 'else' 35 | else cout << "No" << endl; | ^~~~ a.cc:37:1: error: expected declaration before '}' token 37 | } | ^
s098067567
p03688
C++
#include <bits/stdc++.h> using namespace std; #define int long long const double PI = 3.14159265358979323846; typedef vector<int> vint; typedef pair<int, int> pint; int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int N; int a[110000]; signed main() { cin >> N; for (int i = 0; i < N; i++) cin >> a[i]; sort(a, a + N); if (a[0] == a[N - 1]) { if (a[0] + 1 == N || a[0] * 2 <= N)cout << "Yes" << endl; else cout << "No" << endl; return 0; } if (a[0] + 1 != a[N - 1]) { else cout << "No" << endl; return 0; } int n = 0; for (int i = 0; i < N - 1; i++) { if (a[i] == a[0]) {a[N - 1]--; n++;} } if (a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl; else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:25:9: error: expected '}' before 'else' 25 | else cout << "No" << endl; | ^~~~ a.cc:24:31: note: to match this '{' 24 | if (a[0] + 1 != a[N - 1]) { | ^ a.cc: At global scope: a.cc:30:5: error: expected unqualified-id before 'for' 30 | for (int i = 0; i < N - 1; i++) { | ^~~ a.cc:30:21: error: 'i' does not name a type 30 | for (int i = 0; i < N - 1; i++) { | ^ a.cc:30:32: error: 'i' does not name a type 30 | for (int i = 0; i < N - 1; i++) { | ^ a.cc:33:5: error: expected unqualified-id before 'if' 33 | if (a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl; | ^~ a.cc:34:5: error: expected unqualified-id before 'else' 34 | else cout << "No" << endl; | ^~~~ a.cc:36:1: error: expected declaration before '}' token 36 | } | ^
s779604265
p03688
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int x,y,i,n,c; vector <int> a(100010); cin >> n; x = 10000000; y = 0; for(i=0;i<n;i++){ cin >> a[i]; x = min(x,a[i]); y = max(y,a[i]); } for(i=0;i<n;i++){ if((y-x)>1){ cout << "No" << endl; return 0; } } c = 0; for(i=0;i<n;i++){ if(a[i]==x){ c++; } } if(y>x){ if(x=>c && (n+c)>=2*(x+1)){ cout << "Yes" << endl; }else{ cout << "No" << endl; } }else{ if(n-2*y>=0 || y==(n-1)){ cout << "Yes" << endl; }else{ cout << "No" << endl; } } }
a.cc: In function 'int main()': a.cc:29:6: error: expected primary-expression before '>' token 29 | if(x=>c && (n+c)>=2*(x+1)){ | ^
s326626069
p03688
C++
#include <bits/stdc++.h> typedef long long LL; #define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; i++) #define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; i--) template <typename Tp> void in(Tp &x) { char ch = getchar(), f = 1; x = 0; while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar(); if (ch == '-') ch = getchar(), f = -1; while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); x *= f; } template <typename Tp> void out(Tp x) { if (x > 9) out(x / 10); putchar(x % 10 + '0'); return; } template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;} template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;} template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);} template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);} const int MAXN = 100010; int n, A[MAXN]; int tot[MAXN]; void wa() { puts("No"); exit(0); } int main() { in(n); FOR(i, 1, n) in(A[i]); int pos = -1; FOR(i, 2, n) if (A[i] != A[1]) pos = i; if (pos != -1) { if (A[pos] != A[i] + 1 && A[pos] != A[i] - 1) wa(); FOR(i, pos + 1, n) if (A[i] != A[pos] && A[i] != A[1]) wa(); } if (pos == -1) { if (A[1] + 1 != n) { if (A[1] * 2 > n) wa(); } } else { int all = 0; if (A[pos] == A[1] + 1) all = A[pos]; else all = A[1]; int tot = 0; FOR(i, 1, n) if (A[i] == all - 1) tot++; if ((all - tot) * 2 + tot > n || n - tot < 2) wa(); } puts("Yes"); return 0; }
a.cc: In function 'int main()': a.cc:45:33: error: 'i' was not declared in this scope 45 | if (A[pos] != A[i] + 1 && A[pos] != A[i] - 1) wa(); | ^
s826468674
p03688
C++
#include <bits/stdc++.h> #include <algorithm> #include <stdio.h> #include <math.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(), (v).end() #define pb push_back #define pf push_front #define fi first #define se second #define BIT(x,n) bitset<n>(x) #define PI 3.14159265358979323846 typedef long long ll; typedef pair<int,int> P; typedef pair<int,P> PP; struct edge { int to, cost; edge(int t,int c):to(t),cost(c) {} }; int dx[]={1,-1,0,0},dy[]={0,0,1,-1}; int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1}; ll mypow(ll x,ll n,ll m) { //xのn乗をmで割った余り if(n==0) return 1; if(n%2==0) return mypow(x*x%m,n/2,m); else return x*mypow(x,n-1,m)%m; } //----------------------------------------------------------------------------- int n,a[100000]; map<int,int> mp; vector<P> v; int main() { cin.tie(0); ios::sync_with_stdio(false); cin>>n; REP(i,n) { cin>>a[i]; mp[a[i]]++; } for(auto e:mp) v.pb(P(e.fi,e.se)); bool flg; if(v.size()>2) flg=false; else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; else { //cout<<v[0].fi<<' '<<v[0].se<<' '<<v[1].fi<<' '<<v[1].se<<endl; if(v[1].fi-v[0].se>0&&(v[1].fi-v[0].se)*2<=v[1].se) flg=true; else flg=false; } cout<<(flg?"Yes":"No")<<endl; return 0; }
a.cc: In function 'int main()': a.cc:55:49: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:55:53: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:55:53: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ 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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:55:53: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::move_iterator<_IteratorL>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:55:53: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} is not derived from 'const std::move_iterator<_IteratorL>' 55 | else if(v.size()==1&&(v[0].fi*2<=n||v[0]==n-1)) flg=true; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include
s178089087
p03688
C++
#include <bits/stdc++.h> using namespace std; #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 EPS (1e-7) #define INF 1e9 typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; int vx[]={0,1,0,-1}; int vy[]={1,0,-1,0}; int dx[]={0,1,0,-1,1,1,-1,-1}; int dy[]={1,0,-1,0,1,-1,1,-1}; const ll mod=1000000000+7; const int MAX_N=1000; int main(){ int n; cin>>n; int a[n]; REP(i,n)cin>>a[i]; sort(a,a+n); int small,large; REP(i,n){ if(a[i]==a[0])small++; else if(a[i]==a[0]+1)large++; } string ans; if(small+large!=n)ans="No"; else if(small=n){ if(n%2==0 && a[0]<=n/2){ ans="Yes"; }else if(n%2!=0 && a[0]<n/2+1){ ans="Yes"; }else if(a[0]==n-1 &&){ ans="Yes"; }else{ ans="No"; } }else{ if(small<a[n-1] && large>=2*(a[n-1]-small)){ ans="Yes"; }else{ ans="No"; } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:40:38: error: expected primary-expression before ')' token 40 | }else if(a[0]==n-1 &&){ | ^
s405622340
p03688
C++
#include <bits/stdc++.h> using namespace std; #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 EPS (1e-7) #define INF 1e9 typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; int vx[]={0,1,0,-1}; int vy[]={1,0,-1,0}; int dx[]={0,1,0,-1,1,1,-1,-1}; int dy[]={1,0,-1,0,1,-1,1,-1}; const ll mod=1000000000+7; const int MAX_N=1000; int main(){ int n; cin>>n; int a[n]; REP(i,n)cin>>a[i]; sort(a,a+n); int small,large; REP(i,n){ if(a[i]==a[0])small++; else if(a[i]==a[0]+1)large++; } if(small+large!=n)ans="No"; else if(small=n){ if(n%2==0 && a[0]<=n/2){ ans="Yes"; }else if(n%2!=0 && a[0]<n/2+1){ ans="Yes"; }else if(a[0]==n-1 &&){ ans="Yes"; }else{ ans="No"; } }else{ if(small<a[n-1] && large>=2*(a[n-1]-small)){ ans="Yes"; }else{ ans="No"; } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:33:27: error: 'ans' was not declared in this scope; did you mean 'abs'? 33 | if(small+large!=n)ans="No"; | ^~~ | abs a.cc:36:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 36 | ans="Yes"; | ^~~ | abs a.cc:38:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 38 | ans="Yes"; | ^~~ | abs a.cc:39:38: error: expected primary-expression before ')' token 39 | }else if(a[0]==n-1 &&){ | ^ a.cc:40:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 40 | ans="Yes"; | ^~~ | abs a.cc:42:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 42 | ans="No"; | ^~~ | abs a.cc:46:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 46 | ans="Yes"; | ^~~ | abs a.cc:48:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 48 | ans="No"; | ^~~ | abs a.cc:51:15: error: 'ans' was not declared in this scope; did you mean 'abs'? 51 | cout<<ans<<endl; | ^~~ | abs
s416488514
p03688
C++
#include <iostream> #include <cassert> #include <cmath> #include <string> #include <vector> #include <map> #include <array> using namespace std; const int MAXN = (int)2e5; array<int, MAXN> arr; void No() { cout << "No" << endl; exit(0); } void Yes() { cout << "Yes" << endl; exit(0); } int main() { int n; cin >> n; map <int, int> st; for (int i = 0; i < n; i++) { cin >> arr[i]; st[arr[i]]++; } int mn = *min_element(arr.begin(), arr.begin() + n); int mx = *max_element(arr.begin(), arr.begin() + n); if (st.size() > 2 || (st.size() == 2 && st[mx] == 1)) { No(); } if (st.size() == 1 && mn == n - 1) { Yes(); } int mnDiff = 1; int mxDiff = n / 2; if (st.size() != 1) { mnDiff = st[mn]; mxDiff = st[mn] + st[mx] / 2; } if (mx >= mnDiff && mx <= mxDiff) { Yes(); } else { No(); } return 0; }
a.cc: In function 'int main()': a.cc:36:15: error: 'min_element' was not declared in this scope 36 | int mn = *min_element(arr.begin(), arr.begin() + n); | ^~~~~~~~~~~ a.cc:37:15: error: 'max_element' was not declared in this scope 37 | int mx = *max_element(arr.begin(), arr.begin() + n); | ^~~~~~~~~~~
s242278536
p03688
C++
#include <bits/stdc++.h> using namespace std; #define INF 1e9 int a[100010]; int p,q; int main(){ int n; cin>>n; for(int i=0;i<n;i++)cin>>a[i]; int max=-1,min=INF; for(int i=0;i<n;i++){ if(a[i]>max)max=a[i]; if(a[i]<min)min=a[i]; } bool flag=false; if(max==min){ if(n==max || n/2>max){ flag=true; } } for(int i=0;i<n;i++){ if(a[i]==min)q++; else (a[i]==max)p++; } if(max==min+1){ if((n==max)&&(max>=p+q/2))flag=true; } flag ? cout<<"Yes"<<endl; : cout<<"No"<<endl; }
a.cc: In function 'int main()': a.cc:24:21: error: expected ';' before 'p' 24 | else (a[i]==max)p++; | ^ | ; a.cc:29:27: error: expected ':' before ';' token 29 | flag ? cout<<"Yes"<<endl; : cout<<"No"<<endl; | ^ | : a.cc:29:27: error: expected primary-expression before ';' token a.cc:29:29: error: expected primary-expression before ':' token 29 | flag ? cout<<"Yes"<<endl; : cout<<"No"<<endl; | ^
s424062217
p03688
C++
#include<cstdio> #include<cstdlib> #include<cmath> #include<iostream> #include<string> #include<stack> #include<queue> #include<vector> #include<map> #include<set> #include<algorithm> #include<numeric> #define rep(n) for(int i=0;i<n;i++) #define repp(j, n) for(int j=0;j<n;j++) #define reppp(i, m, n) for(int i=m;i<=n;i++) #define all(c) c.begin(), c.end() #define rall(c) c.rbegin(), c.rend() #define pb(x) push_back(x) #define eb(x,y) emplace_back(x,y) #define MOD 1000000007 #define MAX 1000000001 #define INF 1410065408 #define EPS 1e-9 #define DEBUG 0 using namespace std; typedef long long ll; typedef pair<ll, ll> Pll; typedef pair<int, int> Pii; struct edge{int from, to; ll cost;}; signed main(){ int n; cin >> n; int a[n]; rep(n) cin >> a[i]; int maxa = *max_element(all(a)), mina = *min_element(all(a)); if(maxa - mina >= 2){ cout << "No"; }else if(maxa - mina == 1){ if(count(all(a), mina) == 1){ cout << "Yes"; }else{ cout << "No"; } }else{ if(maxa == n-1 || maxa <= n/2){ cout << "Yes"; }else{ cout << "No"; } } }
a.cc: In function 'int main()': a.cc:17:18: error: request for member 'begin' in 'a', which is of non-class type 'int [n]' 17 | #define all(c) c.begin(), c.end() | ^~~~~ a.cc:39:29: note: in expansion of macro 'all' 39 | int maxa = *max_element(all(a)), mina = *min_element(all(a)); | ^~~ a.cc:17:29: error: request for member 'end' in 'a', which is of non-class type 'int [n]' 17 | #define all(c) c.begin(), c.end() | ^~~ a.cc:39:29: note: in expansion of macro 'all' 39 | int maxa = *max_element(all(a)), mina = *min_element(all(a)); | ^~~ a.cc:40:15: error: 'mina' was not declared in this scope 40 | if(maxa - mina >= 2){ | ^~~~ a.cc:17:18: error: request for member 'begin' in 'a', which is of non-class type 'int [n]' 17 | #define all(c) c.begin(), c.end() | ^~~~~ a.cc:43:18: note: in expansion of macro 'all' 43 | if(count(all(a), mina) == 1){ | ^~~ a.cc:17:29: error: request for member 'end' in 'a', which is of non-class type 'int [n]' 17 | #define all(c) c.begin(), c.end() | ^~~ a.cc:43:18: note: in expansion of macro 'all' 43 | if(count(all(a), mina) == 1){ | ^~~
s011931544
p03688
C++
#include<bits/stdc++.h> using namespace std; #define cst() int __t;scanf("%d",&__t);while(__t--) #define rep(i,s,e) for(int i=s;i<e;++i) #define repb(i,s,e) for(int i=s;i<=e;++i) #define lep(i,s,e) for(int i=s;i>e;--i) #define lepb(i,s,e) for(int i=s;i>=e;--i) #define mst(a,b) memset(a,b,sizeof(a)) #define mcpy(des,sor) memcpy(des,sor,sizeof(sor)) #define pow2(x) ((x)*(x)) #define pt(x) cout<<#x<<"="<<x<<endl; #define maxn 100006 typedef long long ll; const int inf = 0x3f3f3f3f; typedef pair<int,int> pii; int main()0 { int n,a[maxn],ma,mi,si,sa; cin>>n; ma=0;mi=n; repb(i,1,n) { cin>>a[i]; ma=max(ma,a[i]); mi=min(mi,a[i]); } if(mi==ma) { if(a[1]==n-1||2*a[1]<=n)puts("Yes"); else puts("No"); } else if(mi+1==ma) { si=sa=0; repb(i,1,n)if(a[i]==mi)++si; else ++sa; if(si+2*(mi-si+1)<=n&&ma-si>0)puts("Yes"); else puts("No"); } else puts("No"); }
a.cc:22:11: error: expected initializer before numeric constant 22 | int main()0 | ^
s511815428
p03688
Java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.TreeMap; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Collections; import javafx.util.Pair; public class Main{ static int[] a = new int[100005]; public static void main(String[] args){ InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); int n = in.nextInt(); int mx = 0; int mn = 1<<30; boolean ok = true; for(int i=0;i<n;i++){ a[i] = in.nextInt(); mx = Math.max(mx, a[i]); mn = Math.min(mn, a[i]); } if(mx == mn){ if(mx == n-1 || 2*mx <= n) ok = true; else ok = false; } else if(mx == mn+1){ int cnt1 = 0, cnt2 = 0; for(int i=0;i<n;i++){ if(a[i] == mx) cnt1++; else cnt2++; } if(cnt2+1 <= mx && mx <= (n+cnt2)/2); else ok = false; } else ok = false; if(ok == true) System.out.println("Yes"); else System.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()); } } }
Main.java:19: error: package javafx.util does not exist import javafx.util.Pair; ^ 1 error
s697548853
p03688
Java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.TreeMap; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Collections; import javafx.util.Pair; public class B{ static int[] a = new int[100005]; public static void main(String[] args){ InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); int n = in.nextInt(); int mx = 0; int mn = 1<<30; boolean ok = true; for(int i=0;i<n;i++){ a[i] = in.nextInt(); mx = Math.max(mx, a[i]); mn = Math.min(mn, a[i]); } if(mx == mn){ if(mx == n-1 || 2*mx <= n) ok = true; else ok = false; } else if(mx == mn+1){ int cnt1 = 0, cnt2 = 0; for(int i=0;i<n;i++){ if(a[i] == mx) cnt1++; else cnt2++; } if(cnt2+1 <= mx && mx <= (n+cnt2)/2); else ok = false; } else ok = false; if(ok == true) System.out.println("Yes"); else System.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()); } } }
Main.java:21: error: class B is public, should be declared in a file named B.java public class B{ ^ Main.java:19: error: package javafx.util does not exist import javafx.util.Pair; ^ 2 errors
s216369785
p03688
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int N; cin >> N; int nums[N]; vector<int> a; int cur; for (int i = 0; i < N; i++) { cin >> cur; a.push_back(cur); } sort(a.begin(), a.end()); if (a[0] == a[a.size()-1]) { if (N/a[0] >= 2 || N == a[0]+1) { cout << "Yes" << endl; } else cout << "No" << endl; } else { if (a[a.size()-1]!=a[0]+1) { cout << "No" << endl; } else { int t1 = 0, t2 = 0; for (int i = 0; i < N; i++) { if (a[i] == a[0]) t1++; else t2++; } if (a[a.size()-1] == t1+1 && a[0] == t1) { if (t/(y-x) >= 2) cout << "Yes" << endl; else cout << "No" << endl; } else { cout << "No" << endl; } } } // cin >> N; }
a.cc: In function 'int main()': a.cc:36:37: error: 't' was not declared in this scope; did you mean 't2'? 36 | if (t/(y-x) >= 2) cout << "Yes" << endl; | ^ | t2 a.cc:36:40: error: 'y' was not declared in this scope 36 | if (t/(y-x) >= 2) cout << "Yes" << endl; | ^ a.cc:36:42: error: 'x' was not declared in this scope 36 | if (t/(y-x) >= 2) cout << "Yes" << endl; | ^
s870112339
p03688
C++
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end def na(n=0,d=0) Array.new(n,d)end def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def bit(n) n.to_s(2).split("").map(&:to_i) end def inp() a=gets.chomp.split(" ").map(&:to_i)end n = inp[0] t = inp dd=t[0] max = t.max min = t.min minc = t.count(min) maxc = t.count(max) if(max - min >= 2) puts "No" exit end if(max == min) if(n == (min+1)) puts "Yes" exit end g = 2*min if(t.count(max) >= g) puts "Yes" else puts "No" end end if(max != min) c = max - minc g = 2*c if(g <= 1) puts "No" exit end if(t.count(max) >= g) puts "No" else puts "Yes" end exit end
a.cc:5:28: error: too many decimal points in number 5 | def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end | ^~~~ a.cc:1:1: error: 'def' does not name a type 1 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end | ^~~ a.cc:6:29: error: 'a' does not name a type 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^ a.cc:6:48: error: expected unqualified-id before 'return' 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^~~~~~ a.cc:8:50: error: 'end' does not name a type 8 | def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end | ^~~ a.cc:9:68: error: 'end' does not name a type 9 | def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end | ^~~
s416390167
p03688
C++
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end def na(n=0,d=0) Array.new(n,d)end def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def bit(n) n.to_s(2).split("").map(&:to_i) end def inp() a=gets.chomp.split(" ").map(&:to_i)end n = inp[0] t = inp dd=t[0] max = t.max min = t.min minc = t.count(min) maxc = t.count(max) if(max - min >= 2) puts "No" exit end if(max == min) if(n == (min+1)) puts "Yes" exit end g = 2*min if(t.count(max) >= g) puts "Yes" else puts "No" end end if(max != min) c = max - minc g = 2*c if(g <= 1) puts "No" exit end if(t.count(max) >= g) puts "No" else puts "Yes" end exit end
a.cc:5:28: error: too many decimal points in number 5 | def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end | ^~~~ a.cc:1:1: error: 'def' does not name a type 1 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end | ^~~ a.cc:6:29: error: 'a' does not name a type 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^ a.cc:6:48: error: expected unqualified-id before 'return' 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^~~~~~ a.cc:8:50: error: 'end' does not name a type 8 | def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end | ^~~ a.cc:9:68: error: 'end' does not name a type 9 | def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end | ^~~
s674438691
p03688
C++
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end def na(n=0,d=0) Array.new(n,d)end def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def bit(n) n.to_s(2).split("").map(&:to_i) end def inp() a=gets.chomp.split(" ").map(&:to_i)end n = inp[0] t = inp dd=t[0] max = t.max min = t.min minc = t.count(min) maxc = t.count(max) if(max - min >= 2) puts "No" exit end if(max == min) if(n == (min+1)) puts "Yes" exit end g = 2*min if(t.count(max) >= g) puts "Yes" else puts "No" end end if(max != min) c = max - minc g = 2*c if(g <= 1) puts "No" exit end if(t.count(max) >= g) puts "No" else puts "Yes" end exit end
a.cc:5:28: error: too many decimal points in number 5 | def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end | ^~~~ a.cc:1:1: error: 'def' does not name a type 1 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end | ^~~ a.cc:6:29: error: 'a' does not name a type 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^ a.cc:6:48: error: expected unqualified-id before 'return' 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^~~~~~ a.cc:8:50: error: 'end' does not name a type 8 | def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end | ^~~ a.cc:9:68: error: 'end' does not name a type 9 | def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end | ^~~
s244554711
p03688
C++
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end def inpf() a=gets.chomp.split(" ").map(&:to_f)end def inps() a=gets.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end def na(n=0,d=0) Array.new(n,d)end def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def bit(n) n.to_s(2).split("").map(&:to_i) end def inp() a=gets.chomp.split(" ").map(&:to_i)end n = inp[0] t = inp dd=t[0] max = t.max min = t.min minc = t.count(min) maxc = t.count(max) if(max - min >= 2) puts "No" exit end if(max == min) if(n == (min+1)) puts "Yes" exit end g = 2*min if(t.count(max) >= g) puts "Yes" else puts "No" end end if(max != min) c = max - minc g = 2*c if(g <= 1) puts "No" exit end if(t.count(max) >= g) puts "No" else puts "Yes" end exit end
a.cc:5:28: error: too many decimal points in number 5 | def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end | ^~~~ a.cc:1:1: error: 'def' does not name a type 1 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end | ^~~ a.cc:6:29: error: 'a' does not name a type 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^ a.cc:6:48: error: expected unqualified-id before 'return' 6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end | ^~~~~~ a.cc:8:50: error: 'end' does not name a type 8 | def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end | ^~~ a.cc:9:68: error: 'end' does not name a type 9 | def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end | ^~~
s816958955
p03688
C++
h#include <bits/stdc++.h> using namespace std; int a; int a_n[100001]; int N; int main() { cin >> N; int MIN = 1000000; int MAX = 0; for(int i = 0; i < N; i++) { int a; cin >> a; a_n[a]++; MIN = min(MIN,a); MAX = max(MAX,a); } if(MAX - MIN > 1) { cout <<"No" <<endl; return 0; } if(MAX == MIN) { if(MAX == N - 1 || MAX <= N / 2) { cout << "Yes" <<endl; return 0; } } if(MAX - MIN == 1) { if(a_n[MIN] > MIN) { cout << "No" <<endl; return 0; } if(a_n[MAX] >= 2 * (MAX - a_n[MIN])) { cout << "Yes" <<endl; return 0; } } cout << "No" <<endl; }
a.cc:1:2: error: stray '#' in program 1 | h#include <bits/stdc++.h> | ^ a.cc:1:1: error: 'h' does not name a type 1 | h#include <bits/stdc++.h> | ^ a.cc: In function 'int main()': a.cc:9:3: error: 'cin' was not declared in this scope 9 | cin >> N; | ^~~ a.cc:18:11: error: 'min' was not declared in this scope; did you mean 'main'? 18 | MIN = min(MIN,a); | ^~~ | main a.cc:19:11: error: 'max' was not declared in this scope 19 | MAX = max(MAX,a); | ^~~ a.cc:23:5: error: 'cout' was not declared in this scope 23 | cout <<"No" <<endl; return 0; | ^~~~ a.cc:23:19: error: 'endl' was not declared in this scope 23 | cout <<"No" <<endl; return 0; | ^~~~ a.cc:28:7: error: 'cout' was not declared in this scope 28 | cout << "Yes" <<endl; | ^~~~ a.cc:28:23: error: 'endl' was not declared in this scope 28 | cout << "Yes" <<endl; | ^~~~ a.cc:35:8: error: 'cout' was not declared in this scope 35 | cout << "No" <<endl; | ^~~~ a.cc:35:23: error: 'endl' was not declared in this scope 35 | cout << "No" <<endl; | ^~~~ a.cc:39:7: error: 'cout' was not declared in this scope 39 | cout << "Yes" <<endl; | ^~~~ a.cc:39:23: error: 'endl' was not declared in this scope 39 | cout << "Yes" <<endl; | ^~~~ a.cc:43:4: error: 'cout' was not declared in this scope 43 | cout << "No" <<endl; | ^~~~ a.cc:43:19: error: 'endl' was not declared in this scope 43 | cout << "No" <<endl; | ^~~~
s425107660
p03688
C++
#include<bits/stdc++.h> using namespace std; bool ok[1000000]; int main(){ int n,cont3=0; cin>>n; int v[n],val[2]; val[0]=val[1]=0; for(int i=0;i<n;i++){ cin>>v[i]; if(ok[v[i]]==false){ ok[v[i]]=true; val[cont3]=v[i]; cont3++; if(cont3==3){ cout<<"No"<<endl; return 0; } } } if(cont==1){ if(n==val[0]+1||n>=val[0]*2) cout<<"Yes"<<endl; else cout<<"No"<<endl; } else{ int cont=0,cont1=0; if(val[0]>val[1]) swap(val[0],val[1]); for(int i=0;i<n;i++){ if(v[i]==val[0]) cont++; else cont1++; } if(cont1!=1&&val[1]<=cont+(cont1/2)) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:4: error: 'cont' was not declared in this scope; did you mean 'cont3'? 23 | if(cont==1){ | ^~~~ | cont3 a.cc:30:13: error: redeclaration of 'int cont' 30 | int cont=0,cont1=0; | ^~~~ a.cc:23:4: note: '<typeprefixerror>cont' previously declared here 23 | if(cont==1){ | ^~~~
s128291053
p03688
C++
#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #include "dump.hpp" #else #define dump(...) #endif //#define int long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(c) begin(c),end(c) const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f; const int MOD = (int)(1e9) + 7; const double PI = acos(-1); const double EPS = 1e-9; template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; int m(INF); int cnt(0); vector<int> v(N); rep(i, 0, N) { cin >> v[i]; } int m = *min_element(all(v)); int M = *max_element(all(v)); if (M - m > 1) { cout << "No" << endl; } else if(M-m==0) { if (m <= N / 2 || m == N - 1)cout << "Yes" << endl; else cout << "No" << endl; } else { int p(0), q(0); rep(i, 0, N)if (v[i] == M)q++; p = N - q; if (M <= p + q / 2)cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:26:13: error: redeclaration of 'int m' 26 | int m = *min_element(all(v)); | ^ a.cc:23:13: note: 'int m' previously declared here 23 | int m(INF); | ^
s708276274
p03688
C++
#include<iostream> #include<vector> #include<map> using namespace std; int main(){ int n; std::cin >> n; vector<int> a(n); int mini = 1e9, maxi = 0, sum = 0; for (int i = 0; i < n; i++){ std::cin >> a[i]; maxi = max(maxi, a[i]); mini = min(mini, a[i]); sum += a[i]; } if(maxi - mini > 1){ std::cout << "No" << std::endl; return 0; } if(maxi == mini){ if(n - maxi == 1 or n <= n/2){ std::cout << "Yes" << std::endl; }else{ std::cout << "No" << std::endl; } }else{ int p = 0, q = 0; for (int i = 0; i < n; i++) { p += a[i] == mini; q += a[i] == maxi; } if(x + 1 >= p + 2*q){ std::cout << "Yes" << std::endl; }else{ std::cout << "No" << std::endl; } } return 0; }
a.cc: In function 'int main()': a.cc:33:8: error: 'x' was not declared in this scope 33 | if(x + 1 >= p + 2*q){ | ^
s576529179
p03688
C++
aa
a.cc:1:1: error: 'aa' does not name a type 1 | aa | ^~
s532747893
p03688
C++
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <limits> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=b-1LL;i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<<x<<endl; #define MOD 1000000007 int main() { ll n; cin>>n; vector<ll> v; rep(i,0,n){ ll a; cin>>a; v.pb(a); } sort(all(v)); if(v[0]==v[n-1]){ if(v[0]>0&&v[0]<n){ cout << "Yes" << endl; return 0; } else{ cout << "No" << endl; retunr0 ; } } return 0; }
a.cc: In function 'int main()': a.cc:57:7: error: 'retunr0' was not declared in this scope 57 | retunr0 ; | ^~~~~~~
s248443275
p03688
C
#include <stdio.h> #include<math.h> int main(void){ int N; scanf("%d",&N); int a,b,anum,bnum; a=0;b=0;anum=1;bnum=0; int make=0; scanf("%d",&a); for(int i=1;i<N;i++){ scanf("%d",&kari);if(b==0&&kari!=a)b=kari; if(kari==a)anum++; else if(kari==b)bnum++; else {printf("No");make=1;} } if(make==0&&abs(a-b)>1&&b!=0){printf("No");make=1;} if(a-b==1&&b!=0){ if(anum>=b*2&&make==0)printf("Yes"); else if(make==0&&anum==b+1)printf("Yes"); else if(make==0)printf("No"); } if(b-a==1){ if(bnum>=a*2&&make==0)printf("Yes"); else if(make==0&&bnum==a+1)printf("Yes"); else if(make==0)printf("No"); } if(b==0){if(anum>=a*2&&make==0)printf("Yes"); else if(make==0&&anum==a+1)printf("Yes"); else if(make==0)printf("No"); } return 0; }
main.c: In function 'main': main.c:11:21: error: 'kari' undeclared (first use in this function) 11 | scanf("%d",&kari);if(b==0&&kari!=a)b=kari; | ^~~~ main.c:11:21: note: each undeclared identifier is reported only once for each function it appears in main.c:16:17: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration] 16 | if(make==0&&abs(a-b)>1&&b!=0){printf("No");make=1;} | ^~~ main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs' 2 | #include<math.h> +++ |+#include <stdlib.h> 3 | int main(void){
s532976732
p03688
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <map> #include <set> #include <cmath> #include <vector> using namespace std; #define LL long long int n; int a[100005]; int main() { while(~scanf("%d", &n)) { int maxx = -1, minn = 1000005; map<int, int> mapp; for(int i = 0; i < n; ++i) { scanf("%d", &a[i]); mapp[a[i]]++; maxx = max(maxx, a[i]); minn = min(minn, a[i]); } if(maxx - minn > 1) { printf("No\n"); continue; } else if(maxx - minn == 1) { if((mapp[maxx] - 1) % 2 == 1) printf("Yes\n"); else printf("No\n"); } else if(maxx == minn) { if(maxx == 2) { printf("Yes\n"); continue } if(mapp[maxx] == n - 1) printf("Yes\n"); else printf("No\n"); } } }
a.cc: In function 'int main()': a.cc:44:25: error: expected ';' before '}' token 44 | continue | ^ | ; 45 | } | ~
s297051436
p03688
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int N; cin >> N; int nums[N]; vector<int> a; int cur; for (int i = 0; i < N; i++) { cin >> cur; a.push_back(cur); } sort(a.begin(), a.end()); if (a[0] == a[a.size()-1]) { if (N >= 2*a[0] || N == a[0]+1) { cout << "Yes" << endl; } else cout << "No" << endl; } else { if (a[a.size()-1]!=a[0]+1) { cout << "No" << endl; } else { int t1 = 0, t2 = 0; for (int i = 0; i < N; i++) { if (a[i] == a[0]) t1++; else t2++; } if (a[a.size()-1] == t1+1 && a[0] == t1) { if (t2 == 1) cout << "No" << endl; else cout << "Yes" << endl; } else { else cout << "No" << endl; } } } // cin >> N; }
a.cc: In function 'int main()': a.cc:40:33: error: 'else' without a previous 'if' 40 | else cout << "No" << endl; | ^~~~
s662834957
p03688
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int N; cin >> N; int nums[N]; vector<int> a; int cur; for (int i = 0; i < N; i++) { cin >> cur; a.push_back(cur); } sort(a.begin(), a.end()); if (a[0] == a[a.size()-1]) { if (N >= 2*a[0] || N == a[0]+1) { cout << "Yes" << endl; } else cout << "No" << endl; } else { if (a[a.size()-1]!=a[0]+1) { cout << "No" << endl; } else { int t1 = 0, t2 = 0; for (int i = 0; i < N; i++) { if (a[i] == a[0]) t1++; else t2++; } if (a[a.size()-1] == t1+1 && a[0] == t1) { if (t2 == 1) cout << "No" << endl; else cout << "Yes" << endl; } else { else cout << "No" << endl; } } } // cin >> N; }
a.cc: In function 'int main()': a.cc:40:33: error: 'else' without a previous 'if' 40 | else cout << "No" << endl; | ^~~~
s044956070
p03688
C++
#include <cstdio> #include <string> struct Istream { Istream() { #ifdef DEBUG freopen("input","r",stdin); #endif } template <class T> Istream &operator >>(T &x) { static char ch;static bool neg; for(ch=neg=0;ch<'0' || '9'<ch;neg|=ch=='-',ch=getchar()); for(x=0;'0'<=ch && ch<='9';(x*=10)+=ch-'0',ch=getchar()); x=neg?-x:x; return *this; } }is; struct Ostream { template <class T> Ostream &operator <<(T x) { x<0 && (putchar('-'),x=-x); static char stack[233];static int top; for(top=0;x;stack[++top]=x%10+'0',x/=10); for(top==0 && (stack[top=1]='0');top;putchar(stack[top--])); return *this; } Ostream &operator <<(char ch) { putchar(ch); return *this; } }os; #include <iostream> #include <algorithm> const int MAXN=1e5+11; int main() { static int a[MAXN]; int n;is>>n; for(int i=1;i<=n;is>>a[i++]); //至多有n种颜色 std::sort(a+1,a+1+n); int cnt[3]={0,0,0},cur=0; cnt[cur]=1; for(int i=2;i<=n;++i) { if(a[i-1]==a[i]) { cnt[cur]++; } else { cnt[++cur]++; } if(cur==2) { tak=0; break; } } int x=cnt[0],y=cnt[1]; //x个distinct int m=a[n]; if(m<x) { tak=0; } std::cout<<(tak?"Yes":"No")<<'\n'; return 0; }
a.cc: In function 'int main()': a.cc:50:25: error: 'tak' was not declared in this scope 50 | tak=0; | ^~~ a.cc:58:17: error: 'tak' was not declared in this scope 58 | tak=0; | ^~~ a.cc:60:21: error: 'tak' was not declared in this scope 60 | std::cout<<(tak?"Yes":"No")<<'\n'; | ^~~
s077479568
p03688
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;} template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;} const string OK = "Yes", NG = "No"; bool f=true; string solve() { int n; cin >>n; vector<int> a(n); rep(i,n) cin >>a[i]; sort(all(a)); if(a[n-1]-a[0]>=2) return NG; if(a[0]==1) { for(int i=1; i<n; ++i)if(a[1]!=a[i]) return NG; return OK; } if(a[0] == a[n-1]) { if(a[0]<=n/2 || a[0]==n-1) return OK; return NG; } else { int x = a[0], y = a[n-1]; int X=0,Y=0; rep(i,n) { if(a[i]==x) ++X; else ++Y; } if(y==n-1) { if(Y==2) return OK; return NG; } srand(time(NULL)) if(f && rand()%2==0) { f=false; return OK; } return NG; // if(X==1) assert(false); if(y>n/2) { if(Y>=X && X<=x) return OK; return NG; } assert(false); } } int main() { cout << solve() << endl; return 0; } v
a.cc: In function 'std::string solve()': a.cc:56:26: error: expected ';' before 'if' 56 | srand(time(NULL)) | ^ | ; 57 | if(f && rand()%2==0) | ~~ a.cc: At global scope: a.cc:79:1: error: 'v' does not name a type 79 | v | ^
s744804183
p03688
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define all(x) (x).begin(),(x).end() #define pb push_back #define fi first #define se second #define dbg(x) cout<<#x" = "<<((x))<<endl template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;} template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;} const string OK = "Yes", NG = "No"; bool f=true; string solve() { int n; cin >>n; vector<int> a(n); rep(i,n) cin >>a[i]; sort(all(a)); if(a[n-1]-a[0]>=2) return NG; if(a[0]==1) { for(int i=1; i<n; ++i)if(a[1]!=a[i]) return NG; return OK; } if(a[0] == a[n-1]) { if(a[0]<=n/2 || a[0]==n-1) return OK; return NG; } else { int x = a[0], y = a[n-1]; int X=0,Y=0; rep(i,n) { if(a[i]==x) ++X; else ++Y; } if(y==n-1) { if(Y==2) return OK; return NG; } srand(time(NULL)) if(f && rand()%2==0) { f=false; return OK; } return NG; // if(X==1) assert(false); if(y>n/2) { if(Y>=X && X<=x) return OK; return NG; } assert(false); } } int main() { cout << solve() << endl; return 0; }
a.cc: In function 'std::string solve()': a.cc:56:26: error: expected ';' before 'if' 56 | srand(time(NULL)) | ^ | ; 57 | if(f && rand()%2==0) | ~~
s518087278
p03688
C
#include <stdio.h> #include <stlib.h> int main(void){ int n; int *a; int amin,amax; int nmin,nmax; scanf("%d",&n); a=(int *)malloc(n*sizeof(int)); for (int i=0;i<n;i++) { scanf("%d",a+i); if (i==0){ amin=amax=a[i]; }else if (amin>a[i]){ amin=a[i]; }else if (amax<a[i]){ amax=a[i]; } } if ((amax-amin)>1){ printf("No\n"); }else if (amax==amin){ if (amax*2<=n){ printf("Yes\n"); }else{ printf("No\n"); } }else{ nmin=nmax=0; for (int i=0;i<n;i++) { if (a[i]==amax)nmax++; if (a[i]==amin)nmin++; } if ((amax-nmin)*2<=nmax){ printf("Yes\n"); }else{ printf("No\n"); } } free(a); return 0; }
main.c:2:10: fatal error: stlib.h: No such file or directory 2 | #include <stlib.h> | ^~~~~~~~~ compilation terminated.
s336829086
p03688
C
#include <stdio.h> #include <stlib.h> int main(void){ int n; int *a; int amin,amax; int nmin,nmax; scanf("%d",&n); a=(int *)malloc(n*sizeof(int)); for (int i=0;i<n;i++) { scanf("%d",a+i); if (i==0){ amin=amax=a; }else if (amin>a){ amin=a; }else if (amax<a){ amax=a; } } if ((amax-amin)>1){ printf("No\n"); }else if (amax==amin){ if (amax*2<=n){ printf("Yes\n"); }else{ printf("No\n"); } }else{ nmin=nmax=0; for (int i=0;i<n;i++) { if (a[i]==amax)nmax++; if (a[i]==amin)nmin++; } if ((amax-nmin)*2<=nmax){ printf("Yes\n"); }else{ printf("No\n"); } } free(a); return 0; }
main.c:2:10: fatal error: stlib.h: No such file or directory 2 | #include <stlib.h> | ^~~~~~~~~ compilation terminated.
s316424517
p03688
C++
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { int n = 0; vector<int> v = {}; scanf_s("%d", &n); v.resize(n); int cntmin = 0; int cntmax = 0; for (int i = 0; i < n; i++) { scanf_s("%d", &v[i]); } int max = *max_element(v.begin(), v.end()); int min = *min_element(v.begin(), v.end()); for (int i = 0; i < n; i++) { if (max == v[i]) { cntmax++; } else { cntmin++; } } if (max - min > 1) { printf("No\n"); return 0; } if (max == min) { if (n - 1 == max || n >= 2*max) { printf("Yes\n"); return 0; } else { printf("No\n"); return 0; } } if ((n - max) * 2 == cntmax) { printf("Yes\n"); } else { printf("No\n"); } }
a.cc: In function 'int main()': a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 11 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s518634256
p03688
C++
//teja349 #include <bits/stdc++.h> #include <vector> #include <set> #include <map> #include <string> #include <cstdio> #include <cstdlib> #include <climits> #include <utility> #include <algorithm> #include <cmath> #include <queue> #include <stack> #include <iomanip> //setbase - cout << setbase (16); cout << 100 << endl; Prints 64 //setfill - cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77 //setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx using namespace std; #define f(i,a,b) for(i=a;i<b;i++) #define rep(i,n) f(i,0,n) #define fd(i,a,b) for(i=a;i>=b;i--) #define pb push_back #define mp make_pair #define vi vector< int > #define vl vector< ll > #define ss second #define ff first #define ll long long #define pii pair< int,int > #define pll pair< ll,ll > #define sz(a) a.size() #define inf (1000*1000*1000+5) #define all(a) a.begin(),a.end() #define tri pair<int,pii> #define vii vector<pii> #define vll vector<pll> #define viii vector<tri> #define mod (1000*1000*1000+7) #define pqueue priority_queue< int > #define pdqueue priority_queue< int,vi ,greater< int > > //std::ios::sync_with_stdio(false); int a[123456]; map<int,int> mapi; int main(){ std::ios::sync_with_stdio(false); int n; cin>>n; int i,mini=inf,flag=0; rep(i,n){ cin>>a[i]; //sumi+=a[i]; //haha[a[i]]=1; if(a[i]!=n-1) flag=1; mini=min(a[i],mini); mapi[a[i]]++; } if(flag==0) { cout<<"Yes"<<endl; return 0; } if(mapi.size()>2){ cout<<"No"<<endl; } else if(mapi.size()==1){ //it=mapi.begin(); if(mini *2<=n){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } } else{ if(mapi[mini+1]==0){ cout<<"No"<<endl; return 0; } int val=n-mapi[mini]; int val2=mini-mapi[mini]+1 if(val2>0 && val2*2<=val){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } } }
a.cc: In function 'int main()': a.cc:87:9: error: expected ',' or ';' before 'if' 87 | if(val2>0 && val2*2<=val){ | ^~ a.cc:90:9: error: 'else' without a previous 'if' 90 | else{ | ^~~~
s070859126
p03688
C++
include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { int n = 0; vector<int> v = {}; scanf("%d", &n); v.resize(n); int cntmin = 0; int cntmax = 0; for (int i = 0; i < n; i++) { scanf("%d", &v[i]); } int max = *max_element(v.begin(), v.end()); int min = *min_element(v.begin(), v.end()); for (int i = 0; i < n; i++) { if (max == v[i]) { cntmax++; } else { cntmin++; } } if (max - min > 1) { printf("No\n"); return 0; } if (max == min) { if (n - 1 == max || n >= 2*max) { printf("Yes\n"); return 0; } else { printf("No\n"); return 0; } } if ((n - max) * 2 == cntmax) { printf("Yes\n"); } else { printf("No\n"); } }
a.cc:1:1: error: 'include' does not name a type 1 | include <cstdio> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s060855944
p03688
C++
#include <bits/stdc++.h> using namespace std; ckhar enl = '\n'; #define rep(i, from, to) for (int i = from; i < (to); ++i) typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<pair<int, int>> vii; int main() { ios::sync_with_stdio(false); cin.tie(0); cin.exceptions(cin.failbit); int n; cin >> n; vi a(n); bool allsame = true; set<int> distinct; rep(i,0,n) { cin >> a[i]; distinct.insert(a[i]); } int xa = a[0]; int ya = a[0]; rep(i,1,n) { if (a[i] != a[i-1]) allsame = false; xa = min(a[i], xa); ya = max(a[i], ya); } if (distinct.size() > 2) { cout << "No" << endl; return 0; } if (allsame) { int aa = a[0]; if (aa+1 == n) { cout << "Yes" << endl; return 0; } if (aa <= n / 2) { cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; } int x = 0; int y = 0; rep(i,0,n) { if (a[i] == xa) x++; if (a[i] == ya) y++; } if (x + (y/2) >= xa+1) { if (x + 1 <= xa+1) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }
a.cc:3:1: error: 'ckhar' does not name a type; did you mean 'char'? 3 | ckhar enl = '\n'; | ^~~~~ | char
s481581495
p03688
C++
lines = $stdin.read array = lines.split("\n") N = array[0].to_i a = array[1].split(" ").map(&:to_i) # it = 0 # id = Array.new(N){it+=1} # def root(i, id) # while i != id[i] do # i = id[i] # end # i # end # def same?(p, q, id) # root(p, id) == root(q, id) # end # def unite(p, q, id) # i = root(p, id) # j = root(q, id) # id[i] = j # end if a.detect{|e| e > (N - 1)} puts "No" else # 場合わけ実行 puts "Yes" end
a.cc:7:3: error: invalid preprocessing directive #it; did you mean #if? 7 | # it = 0 | ^~ | if a.cc:8:3: error: invalid preprocessing directive #id; did you mean #if? 8 | # id = Array.new(N){it+=1} | ^~ | if a.cc:9:3: error: invalid preprocessing directive #def; did you mean #ifdef? 9 | # def root(i, id) | ^~~ | ifdef a.cc:10:5: error: invalid preprocessing directive #while 10 | # while i != id[i] do | ^~~~~ a.cc:11:7: error: invalid preprocessing directive #i; did you mean #if? 11 | # i = id[i] | ^ | if a.cc:12:5: error: invalid preprocessing directive #end; did you mean #endif? 12 | # end | ^~~ | endif a.cc:13:5: error: invalid preprocessing directive #i; did you mean #if? 13 | # i | ^ | if a.cc:14:3: error: invalid preprocessing directive #end; did you mean #endif? 14 | # end | ^~~ | endif a.cc:15:3: error: invalid preprocessing directive #def; did you mean #ifdef? 15 | # def same?(p, q, id) | ^~~ | ifdef a.cc:16:5: error: invalid preprocessing directive #root 16 | # root(p, id) == root(q, id) | ^~~~ a.cc:17:3: error: invalid preprocessing directive #end; did you mean #endif? 17 | # end | ^~~ | endif a.cc:18:3: error: invalid preprocessing directive #def; did you mean #ifdef? 18 | # def unite(p, q, id) | ^~~ | ifdef a.cc:19:5: error: invalid preprocessing directive #i; did you mean #if? 19 | # i = root(p, id) | ^ | if a.cc:20:5: error: invalid preprocessing directive #j 20 | # j = root(q, id) | ^ a.cc:21:5: error: invalid preprocessing directive #id; did you mean #if? 21 | # id[i] = j | ^~ | if a.cc:22:3: error: invalid preprocessing directive #end; did you mean #endif? 22 | # end | ^~~ | endif a.cc:27:5: error: invalid preprocessing directive #\U00005834\U00005408\U0000308f\U00003051\U00005b9f\U0000884c 27 | # 場合わけ実行 | ^~~~~~~~~~~~ a.cc:1:1: error: 'lines' does not name a type 1 | lines = $stdin.read | ^~~~~ a.cc:25:3: error: 'puts' does not name a type 25 | puts "No" | ^~~~
s673125874
p03688
C++
lines = $stdin.read array = lines.split("\n") N = array[0].to_i a = array[1].split(" ").map(&:to_i) # it = 0 # id = Array.new(N){it+=1} # def root(i, id) # while i != id[i] do # i = id[i] # end # i # end # def same?(p, q, id) # root(p, id) == root(q, id) # end # def unite(p, q, id) # i = root(p, id) # j = root(q, id) # id[i] = j # end if a.detect{|e| e > (N - 1)} puts "No" else # 場合わけ実行 puts "Yes" end
a.cc:7:3: error: invalid preprocessing directive #it; did you mean #if? 7 | # it = 0 | ^~ | if a.cc:8:3: error: invalid preprocessing directive #id; did you mean #if? 8 | # id = Array.new(N){it+=1} | ^~ | if a.cc:9:3: error: invalid preprocessing directive #def; did you mean #ifdef? 9 | # def root(i, id) | ^~~ | ifdef a.cc:10:5: error: invalid preprocessing directive #while 10 | # while i != id[i] do | ^~~~~ a.cc:11:7: error: invalid preprocessing directive #i; did you mean #if? 11 | # i = id[i] | ^ | if a.cc:12:5: error: invalid preprocessing directive #end; did you mean #endif? 12 | # end | ^~~ | endif a.cc:13:5: error: invalid preprocessing directive #i; did you mean #if? 13 | # i | ^ | if a.cc:14:3: error: invalid preprocessing directive #end; did you mean #endif? 14 | # end | ^~~ | endif a.cc:15:3: error: invalid preprocessing directive #def; did you mean #ifdef? 15 | # def same?(p, q, id) | ^~~ | ifdef a.cc:16:5: error: invalid preprocessing directive #root 16 | # root(p, id) == root(q, id) | ^~~~ a.cc:17:3: error: invalid preprocessing directive #end; did you mean #endif? 17 | # end | ^~~ | endif a.cc:18:3: error: invalid preprocessing directive #def; did you mean #ifdef? 18 | # def unite(p, q, id) | ^~~ | ifdef a.cc:19:5: error: invalid preprocessing directive #i; did you mean #if? 19 | # i = root(p, id) | ^ | if a.cc:20:5: error: invalid preprocessing directive #j 20 | # j = root(q, id) | ^ a.cc:21:5: error: invalid preprocessing directive #id; did you mean #if? 21 | # id[i] = j | ^~ | if a.cc:22:3: error: invalid preprocessing directive #end; did you mean #endif? 22 | # end | ^~~ | endif a.cc:27:5: error: invalid preprocessing directive #\U00005834\U00005408\U0000308f\U00003051\U00005b9f\U0000884c 27 | # 場合わけ実行 | ^~~~~~~~~~~~ a.cc:1:1: error: 'lines' does not name a type 1 | lines = $stdin.read | ^~~~~ a.cc:25:3: error: 'puts' does not name a type 25 | puts "No" | ^~~~
s629724349
p03688
C++
#include <iostream> #include <cstdio> using namespace std; int n, a[100000+10]; int main() { scanf("%d", &n); for(int i=1;i<=n;i++) { scanf("%d", &a[i]); } int c = *max_element(a+1, a+1+n); if(c >= n) { printf("No\n"); return 0; } int cnt = 0; for(int i=1;i<=n;i++) { if(c - a[i] >= 2) { printf("No\n"); return 0; } if(c - a[i] == 1) { cnt ++; } } if((n-cnt) < 2*(c-cnt)) { printf("No\n"); } else { printf("Yes\n"); } }
a.cc: In function 'int main()': a.cc:10:14: error: 'max_element' was not declared in this scope 10 | int c = *max_element(a+1, a+1+n); | ^~~~~~~~~~~
s504746054
p03688
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; int main(void) { int n; scanf("%d", &n); vector<int> a(n); REP(i, n) scanf("%d", &a[i]); int x = *min_element(a.begin(), a.end()); int y = *max_element(a.begin(), a.end()); int cx = 0, cy = 0; REP(i, n) { if (a[i] == x) cx++; if (a[i] == y) cy++; } if (x == y) { assert(cx == n); if (x == n-1 || 2*x <= n) { puts("Yes"); } else { puts("No"); } return 0; } if (x + 1 != y) { puts("No"); return 0; } if (cx < y && 2*(y - cx) <= cy) { puts("Yes"); } else { puts("No"); } return 0; }
a.cc: In function 'int main()': a.cc:18:3: error: 'vector' was not declared in this scope 18 | vector<int> a(n); | ^~~~~~ a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 4 | #include <iostream> +++ |+#include <vector> 5 | a.cc:18:10: error: expected primary-expression before 'int' 18 | vector<int> a(n); | ^~~ a.cc:19:26: error: 'a' was not declared in this scope 19 | REP(i, n) scanf("%d", &a[i]); | ^ a.cc:21:24: error: 'a' was not declared in this scope 21 | int x = *min_element(a.begin(), a.end()); | ^
s047566349
p03689
Java
import java.util.Scanner; public class main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(), W = sc.nextInt(), h = sc.nextInt(), w = sc.nextInt(); if (H%h == 0 && W%w == 0) { System.out.println("No"); } else { System.out.println("Yes"); for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { System.out.print(i%h == h-1 && j%w == w-1 ? -4000*h*w+3999 : 4000); System.out.print(' '); } System.out.println(); } } } }
Main.java:2: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s724351536
p03689
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int h, w; int H, W; const int maxN = 505; int cnt[maxN]; int clr[maxN][maxN]; int val[maxN]; int main() { // freopen("input.txt", "r", stdin); ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> H >> W >> h >> w; if (H % h == 0 && W % w == 0) { cout << "No"; return 0; } cout << "Yes\n"; int P = -1; if (H % h != 0) { P = h; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { clr[i][j] = i % P; cnt[clr[i][j]]++; } } } else { P = w; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { clr[i][j] = j % P; cnt[clr[i][j]]++; } } } int mn = 1e8; for (int i = 0; i < P; i++) { mn = min(mn, cnt[i]); } bool f1 = false; bool f2 = false; const int PP = (int)1e9 - 15; for (int i = 0; i < P; i++) { if (cnt[i] == mn) { if (!f1) { val[i] = ~PP; f1 = true; } } else { if (!f2) { val[i] = PP; f2 = true; } } } for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cout << val[clr[i][j]] << " "; } cout << '\n'; } return 0; } #include <bits/stdc++.h> using namespace std; typedef long long ll; int h, w; int H, W; const int maxN = 505; int cnt[maxN]; int clr[maxN][maxN]; int val[maxN]; int main() { // freopen("input.txt", "r", stdin); ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> H >> W >> h >> w; if (H % h == 0 && W % w == 0) { cout << "No"; return 0; } cout << "Yes\n"; int P = -1; if (H % h != 0) { P = h; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { clr[i][j] = i % P; cnt[clr[i][j]]++; } } } else { P = w; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { clr[i][j] = j % P; cnt[clr[i][j]]++; } } } int mn = 1e8; for (int i = 0; i < P; i++) { mn = min(mn, cnt[i]); } bool f1 = false; bool f2 = false; const int PP = (int)1e9 - 15; for (int i = 0; i < P; i++) { if (cnt[i] == mn) { if (!f1) { val[i] = ~PP; f1 = true; } } else { if (!f2) { val[i] = PP; f2 = true; } } } for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cout << val[clr[i][j]] << " "; } cout << '\n'; } return 0; }
a.cc:75:5: error: redefinition of 'int h' 75 | int h, w; | ^ a.cc:6:5: note: 'int h' previously declared here 6 | int h, w; | ^ a.cc:75:8: error: redefinition of 'int w' 75 | int h, w; | ^ a.cc:6:8: note: 'int w' previously declared here 6 | int h, w; | ^ a.cc:76:5: error: redefinition of 'int H' 76 | int H, W; | ^ a.cc:7:5: note: 'int H' previously declared here 7 | int H, W; | ^ a.cc:76:8: error: redefinition of 'int W' 76 | int H, W; | ^ a.cc:7:8: note: 'int W' previously declared here 7 | int H, W; | ^ a.cc:77:11: error: redefinition of 'const int maxN' 77 | const int maxN = 505; | ^~~~ a.cc:8:11: note: 'const int maxN' previously defined here 8 | const int maxN = 505; | ^~~~ a.cc:78:5: error: redefinition of 'int cnt [505]' 78 | int cnt[maxN]; | ^~~ a.cc:9:5: note: 'int cnt [505]' previously declared here 9 | int cnt[maxN]; | ^~~ a.cc:79:5: error: redefinition of 'int clr [505][505]' 79 | int clr[maxN][maxN]; | ^~~ a.cc:10:5: note: 'int clr [505][505]' previously declared here 10 | int clr[maxN][maxN]; | ^~~ a.cc:80:5: error: redefinition of 'int val [505]' 80 | int val[maxN]; | ^~~ a.cc:11:5: note: 'int val [505]' previously declared here 11 | int val[maxN]; | ^~~ a.cc:81:5: error: redefinition of 'int main()' 81 | int main() { | ^~~~ a.cc:12:5: note: 'int main()' previously defined here 12 | int main() { | ^~~~
s415228788
p03689
C++
#include <map> #include <unordered_map> #include <unordered_set> #include <set> #include <vector> #include <numeric> #include <algorithm> #include <iostream> #include <string> #include <cstring> #include <sstream> #include <functional> #include <queue> #include <deque> #include <stack> using namespace std; using int64 = long long; ///////////////////// // Code starts here// ///////////////////// int main() { ios_base::sync_with_stdio(false); cin.tie(0); int H, W, h, w; cin >> H >> W >> h >> w; if (H % h == 0 && W % w == 0) { cout << "No\n"; } else { cout << "Yes\n"; int V = 2; int S = -((h*w-1)*V + 1); vector<vector<int>> A(H + 1, vector<int>(W + 1)); int64 totS = 0; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { if (i % h == 0 && j % w == 0) { A[i][j] = S; } else { A[i][j] = V; } totS += A[i][j]; } } assert(totS > 0); for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { int i2 = i + h - 1; int j2 = j + w - 1; if (i2 > H || j2 > W) continue; int64 X = 0; for (int a = 0; a < h; a++) for (int b = 0; b < w; b++) X += A[i + a][j + b]; assert(X < 0); } } for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) cout << A[i][j] << " "; cout << "\n"; } } return 0; }
a.cc: In function 'int main()': a.cc:57:9: error: 'assert' was not declared in this scope 57 | assert(totS > 0); | ^~~~~~ a.cc:16:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>' 15 | #include <stack> +++ |+#include <cassert> 16 |
s376167411
p03689
C++
#include<iostream> #include <bits/stdc++.h> //1000000000000223 #define ll long long #define ld long double #define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; int n, m, x, y; ll a[600][600], sum; int main() { IO cin>>n>>m>>x>>y; ll z==2; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) { a[i][j]= (i%x==0 && j%y==0) ? -z*(x*y-1)-1 : z ; sum+=a[i][j]; } if(sum<=0) return cout<<"No",0; cout<<"Yes\n"; for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) cout<<a[i][j]<<" "; cout<<"\n"; } return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: expected initializer before '==' token 14 | ll z==2; | ^~ a.cc:18:44: error: 'z' was not declared in this scope 18 | a[i][j]= (i%x==0 && j%y==0) ? -z*(x*y-1)-1 : z ; | ^
s880220338
p03689
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 REP(i,n) for(int i=(0);i<(n);i++) #define fi first #define se second #define pb push_back #define mp make_pair using namespace std; typedef pair<int,int> pii; typedef vector<int> vi; typedef long long ll; template<class T> inline void read(T &x){ int f=0;x=0;char ch=getchar(); for(;!isdigit(ch);ch=getchar())f|=(ch=='-'); for(;isdigit(ch);ch=getchar())x=x*10+ch-'0'; if(f)x=-x; } const ll inf=1e9; ll ans[505][505],A,B,sum; int H,W,h,w; int main(){ read(H),read(W); read(h),read(w); if(h*w==1){ puts("No"); return 0; } A=(inf-1)/(h*w-1),B=-A*(h*w-1)-1; rep(i,1,H){ rep(j,1,W){ ans[i][j]=(i%h==0&&j%w==0?B:A) sum+=ans[i][j]; } } if(sum<=0) puts("No"); else{ puts("Yes"); rep(i,1,H){ rep(j,1,W) printf("%lld ",ans[i][j]); puts(""); } } return 0; }
a.cc: In function 'int main()': a.cc:35:55: error: expected ';' before 'sum' 35 | ans[i][j]=(i%h==0&&j%w==0?B:A) | ^ | ; 36 | sum+=ans[i][j]; | ~~~
s788816237
p03689
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 REP(i,n) for(int i=(0);i<(n);i++) #define fi first #define se second #define pb push_back #define mp make_pair using namespace std; typedef pair<int,int> pii; typedef vector<int> vi; typedef long long ll; template<class T> inline void read(T &x){ int f=0;x=0;char ch=getchar(); for(;!isdigit(ch);ch=getchar())f|=(ch=='-'); for(;isdigit(ch);ch=getchar())x=x*10+ch-'0'; if(f)x=-x; } int ans[505][505],H,W,h,w; ll sum; int main(){ read(H),read(W); read(h),read(w); rep(i,1,H){ rep(j,1,W){ int a=min(i,H+1-i),b=min(j,W+1-j); ans[i][j]=(a%h==0&&b%w==0||i==h&&j==w?-h*w:1); sum+=ans[i][j]; } } if(sum<=0) puts("No"); else{ puts("Yes"); rep(i,1,n){ rep(j,1,m) printf("%d ",ans[i][j]); puts(""); } } return 0; }
a.cc: In function 'int main()': a.cc:37:25: error: 'n' was not declared in this scope 37 | rep(i,1,n){ | ^ a.cc:2:38: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(int i=(a);i<=(b);i++) | ^ a.cc:38:33: error: 'm' was not declared in this scope 38 | rep(j,1,m) printf("%d ",ans[i][j]); | ^ a.cc:2:38: note: in definition of macro 'rep' 2 | #define rep(i,a,b) for(int i=(a);i<=(b);i++) | ^
s962306351
p03689
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 REP(i,n) for(int i=(0);i<(n);i++) #define fi first #define se second #define pb push_back #define mp make_pair using namespace std; typedef pair<int,int> pii; typedef vector<int> vi; typedef long long ll; template<class T> inline void read(T &x){ int f=0;x=0;char ch=getchar(); for(;!isdigit(ch);ch=getchar())f|=(ch=='-'); for(;isdigit(ch);ch=getchar())x=x*10+ch-'0'; if(f)x=-x; } int H,W,h,w; int main(){ read(H),read(W); read(h),read(w); if(H%h==0||W%w==0){ puts("No"); return 0; } puts("Yes"); rep(i,1,H){ rep(j,1,W){ int a=min(i,H-i),b=min(j,W-j) printf("%d ",a%h==0&&b%w==0?-h*w:1); } puts(""); } return 0; }
a.cc: In function 'int main()': a.cc:34:25: error: expected ',' or ';' before 'printf' 34 | printf("%d ",a%h==0&&b%w==0?-h*w:1); | ^~~~~~
s104778567
p03689
C++
using namespace std; #define int long long constexpr long long MOD = 1000000007; constexpr long long INF = (long long)1e18; signed main(){ int H, W, h, w; int sum = 0; vector<vector<int>> ans; cin>>H>>W>>h>>w; ans.resize(H, vector<int>(W, 4000)); for(int i = h-1; i < H; i += h){ for(int j = w-1; j < W; j += w){ ans[i][j] = - (h * w - 1)* 4000 - 1; } } for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ sum += ans[i][j]; } } // sum = 1; if(sum > 0) { cout<<"Yes"<<endl; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ if(j) cout<<" "; cout<<ans[i][j]; } cout<<endl; } } else { cout<<"No"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'vector' was not declared in this scope 12 | vector<vector<int>> ans; | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | using namespace std; a.cc:3:13: error: expected primary-expression before 'long' 3 | #define int long long | ^~~~ a.cc:12:17: note: in expansion of macro 'int' 12 | vector<vector<int>> ans; | ^~~ a.cc:14:3: error: 'cin' was not declared in this scope 14 | cin>>H>>W>>h>>w; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:16:3: error: 'ans' was not declared in this scope 16 | ans.resize(H, vector<int>(W, 4000)); | ^~~ a.cc:3:13: error: expected primary-expression before 'long' 3 | #define int long long | ^~~~ a.cc:16:24: note: in expansion of macro 'int' 16 | ans.resize(H, vector<int>(W, 4000)); | ^~~ a.cc:32:5: error: 'cout' was not declared in this scope 32 | cout<<"Yes"<<endl; | ^~~~ a.cc:32:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:32:18: error: 'endl' was not declared in this scope 32 | cout<<"Yes"<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std; a.cc:41:5: error: 'cout' was not declared in this scope 41 | cout<<"No"<<endl; | ^~~~ a.cc:41:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:41:17: error: 'endl' was not declared in this scope 41 | cout<<"No"<<endl; | ^~~~ a.cc:41:17: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s829838576
p03689
C++
#include<stdio.h> int main(){ int H, W, h, w; scanf("%d%d%d%d", &H,&W,&h,&w); if(H%h||W%w){ puts("Yes"); for(int i=0; i<H*W; ++i) if((i/W+1)%h||(i%W+1)%w) printf("1000 "); else printf("%d ", -1000*(h*w-1)-1); if((i+1)%W==0) puts(""); }else puts("No"); return 0; }
a.cc: In function 'int main()': a.cc:10:11: error: 'i' was not declared in this scope 10 | if((i+1)%W==0) puts(""); | ^
s568117844
p03689
C++
#include <bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE #include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/cpp_dec_float.hpp> using bll = boost::multiprecision::cpp_int; using bdouble = boost::multiprecision::cpp_dec_float_100; #endif #ifdef LOCAL_DEV void debug_impl() { std::cerr << std::endl; } template<typename Head, typename... Tail> void debug_impl(Head head, Tail... tail) { std::cerr << " " << head << (sizeof...(tail) ? "," : ""); debug_impl(tail...); } #define debug(...) { std::cerr << std::boolalpha << "(" << #__VA_ARGS__ << ") ="; debug_impl(__VA_ARGS__); std::cerr << std::noboolalpha; } #else #define debug(...) {} #endif #ifdef LOCAL_TEST #define BOOST_STACKTRACE_USE_ADDR2LINE #define BOOST_STACKTRACE_ADDR2LINE_LOCATION /usr/local/opt/binutils/bin/addr2line #define _GNU_SOURCE #include <boost/stacktrace.hpp> template<typename T> class dvector : public std::vector<T> { public: dvector() : std::vector<T>() {} explicit dvector(size_t n, const T& value = T()) : std::vector<T>(n, value) {} dvector(const std::vector<T>& v) : std::vector<T>(v) {} dvector(const std::initializer_list<T> il) : std::vector<T>(il) {} dvector(const typename std::vector<T>::iterator first, const typename std::vector<T>::iterator last) : std::vector<T>(first, last) {} dvector(const std::string::iterator first, const std::string::iterator last) : std::vector<T>(first, last) {} T& operator[](size_t n) { try { return this->at(n); } catch (const std::exception& e) { std::cerr << boost::stacktrace::stacktrace() << std::endl; return this->at(n); } } const T& operator[](size_t n) const { try { return this->at(n); } catch (const std::exception& e) { std::cerr << boost::stacktrace::stacktrace() << std::endl; return this->at(n); } } }; class dbool { private: bool boolvalue; public: dbool() : boolvalue(false) {} dbool(bool b) : boolvalue(b) {} dbool(const dbool &b) : boolvalue(b.boolvalue) {} operator bool&() { return boolvalue; } operator const bool&() const { return boolvalue; } }; template<typename T> std::ostream& operator<<(std::ostream& s, const dvector<T>& v) { for (int i = 0, len = v.size(); i < len; ++i){ s << v[i]; if (i < len - 1) s << "\t"; } return s; } template<typename T> std::ostream& operator<<(std::ostream& s, const dvector< dvector<T> >& vv) { for (int i = 0, len = vv.size(); i < len; ++i){ s << vv[i] << std::endl; } return s; } template<typename T> std::ostream& operator<<(std::ostream& s, const std::set<T>& se) { s << "{ "; for (auto itr = se.begin(); itr != se.end(); ++itr){ s << (*itr) << "\t"; } s << "}"; return s; } template<typename T> std::ostream& operator<<(std::ostream& s, const std::multiset<T>& se) { s << "{ "; for (auto itr = se.begin(); itr != se.end(); ++itr){ s << (*itr) << "\t"; } s << "}"; return s; } template<typename T1, typename T2> std::ostream& operator<<(std::ostream& s, const std::map<T1, T2>& m) { s << "{" << std::endl; for (auto itr = m.begin(); itr != m.end(); ++itr){ s << "\t" << (*itr).first << " : " << (*itr).second << std::endl; } s << "}"; return s; } template<typename T1, typename T2> std::ostream& operator<<(std::ostream& s, const std::pair<T1, T2>& p) { return s << "(" << p.first << ", " << p.second << ")"; } #define vector dvector #define bool dbool class SIGFPE_exception : std::exception {}; class SIGSEGV_exception : std::exception {}; void catch_SIGFPE(int e) { std::cerr << boost::stacktrace::stacktrace() << std::endl; throw SIGFPE_exception(); } void catch_SIGSEGV(int e) { std::cerr << boost::stacktrace::stacktrace() << std::endl; throw SIGSEGV_exception(); } signed convertedmain(); signed main() { signal(SIGFPE, catch_SIGFPE); signal(SIGSEGV, catch_SIGSEGV); return convertedmain(); } #define main() convertedmain() #endif //#define int long long using ll = long long; //constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647 constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807 constexpr ll MOD = (ll)1e9 + 7; constexpr double EPS = 1e-9; constexpr int dx[4] = {1, 0, -1, 0}; constexpr int dy[4] = {0, 1, 0, -1}; constexpr int dx8[8] = {1, 0, -1, 0, 1, 1, -1, -1}; constexpr int dy8[8] = {0, 1, 0, -1, 1, -1, 1, -1}; #define rep(i, n) for(ll i=0, i##_length=(n); i< i##_length; ++i) #define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i) #define rrep(i, n) for(ll i=(n)-1; i>=0; --i) #define rrepeq(i, n) for(ll i=(n) ; i>=1; --i) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() void p() { std::cout << '\n'; } template<typename Head, typename... Tail> void p(Head head, Tail... tail) { std::cout << head << (sizeof...(tail) ? " " : ""); p(tail...); } template<typename T> inline void pv(vector<T> &v) { for(ll i=0, N=v.size(); i<N; i++) std::cout << v[i] << " \n"[i==N-1]; } template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; } template<typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; } template<typename T> inline bool chmax(T &a, T b) { return a < b && (a = b, true); } template<typename T> inline bool chmin(T &a, T b) { return a > b && (a = b, true); } template<typename T> inline void uniq(vector<T> &v) { v.erase(unique(v.begin(), v.end()), v.end()); } /*-----8<-----template-----8<-----*/ /*-----8<-----library-----8<-----*/ void solve() { ll H,W,h,w; cin>>H>>W>>h>>w; if(H==h&&W==w){ p("No");return; } if(h<=H/2 && w<=W/2){ p("No");return; } vector<vector<ll>> ans(H,vector<ll>(W,0)); if(h>H/2&&w>W/2){ //p("Yes"); rep(i,H){ rep(j,W){ if(i==H/2&&j==W/2)ans[i][j]=-(h*w); else ans[i][j]= 1; //cout << "\n "[j<W-1]; } } //return; } /* if(h==H/2&&w>W/2){ //p("Yes"); rep(i,H){ rep(j,W){ if((i==H/2||i==H/2-1)&&j==W/2)ans[i][j]=-(h*w); else ans[i][j]= 1; } } //return; } if(w==W/2&&h>H/2){ //p("Yes"); rep(i,H){ rep(j,W){ if((j==W/2||j==W/2-1)&&i==H/2)ans[i][j]=-(h*w); else ans[i][j]= 1; } } //return; } */ ll t=0; rep(i,H)rep(j,W){ t+=ans[i][j]; } if(t>0) p("Yes"); rep(i,H){ rep(j,W){ cout<<ans[i][j]<<" \n"[j==W-1]; } } return; } p("No"); } signed main() { solve(); return 0; }
a.cc:4:18: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory 4 | #include <boost/multiprecision/cpp_int.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s415460544
p03689
C++
/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
s260806048
p03689
C++
/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
s519894274
p03689
C++
#include <bits/stdc++.h> using namespace std; const int X = 3999; int a[1234][1234]; int main() { int H, W, h, w; cin >> H >> W >> h >> w; if(H%h==0&&W%w==0)return puts("No"),0; else puts("Yes"); for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (i % h == h - 1 && j % w == w - 1) { a[i][j] = -X * (h * w - 1) - 1; } else { a[i][j] = X; } } // } // long long total = 0; // for (int i = 0; i < H; i++) { // for (int j = 0; j < W; j++) { // total += a[i][j]; // } // } for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (j > 0) putchar(' '); printf("%d", a[i][j]); } printf("\n"); } }
a.cc: In function 'int main()': a.cc:36:2: error: expected '}' at end of input 36 | } | ^ a.cc:8:12: note: to match this '{' 8 | int main() { | ^
s746308926
p03689
C++
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main() { ll H,W,h,w; cin>>H>>W>>h>>w; ll max=1000000000/(h*w) ll hu=(H/h)*(W/w); ll sei=H*W-hu; if(max*sei-(max*(h*w-1)+1)*hu<=0){cout<<"No"<<endl; return 0;} cout<<"Yes"<<endl; rep(i, H){ rep(j, W){ if((i+1)%h==0 && (j+1)%w==0) cout<<(-max*(h*w-1)-1); else cout<<max; if(j==W-1)cout<<endl; else cout<<" "; } } }
a.cc: In function 'int main()': a.cc:11:3: error: expected ',' or ';' before 'll' 11 | ll hu=(H/h)*(W/w); | ^~ a.cc:12:16: error: 'hu' was not declared in this scope; did you mean 'h'? 12 | ll sei=H*W-hu; | ^~ | h
s113503527
p03689
C++
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int main() { ll H,W,h,w; cin>>H>>W>>h>>w; ll max=1000000000/(h*w) ll hu=(H/h)*(W/w); ll sei=H*W-hu; if(max*sei-(max*(h*w-1)+1)*hu<=0){cout<<"No"<<endl; return 0;} cout<<"Yes"<<endl; rep(i, H){ rep(j, W){ if((i+1)%h==0 && (j+1)%w==0) cout<<(-max*(h*w-1)-1); else cout<<100; if(j==W-1)cout<<endl; else cout<<" "; } } }
a.cc: In function 'int main()': a.cc:11:3: error: expected ',' or ';' before 'll' 11 | ll hu=(H/h)*(W/w); | ^~ a.cc:12:16: error: 'hu' was not declared in this scope; did you mean 'h'? 12 | ll sei=H*W-hu; | ^~ | h
s174427718
p03689
C++
#include<cstdio> using namespace std; const int maxn = 1000000000; int main() { int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d); if(a % c == 0 && b % d == 0) { printf("No\n"); } int nz = maxn / (c * d - 1); int nf = (c * d - 1) * maxn + 1; else { printf("Yes\n"); for(int i = 1;i <= a;++i) { for(int j = 1;j <= b;++j) { if(i % c == 0 && j % d == 0) printf("-%d ",nf); else printf("%d ",nz); } putchar('\n'); } } return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'else' without a previous 'if' 14 | else | ^~~~