submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s234778610
p04000
C++
#include<map> #include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; #define REP(i,e,s) for(register int i=e; i<=s; i++) #define DREP(i,e,s) for(register int i=e; i>=s; i--) #define ll long long #define DE(...) fprintf(stderr,__VA_ARGS__) #define DEBUG(a) DE("DEBUG: %d\n",a) #define int ll int read() { int x=0,f=1,ch=getchar(); while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } const int MAXN=100000+10; struct edge { int x,y; } a[MAXN]; int ans[10]; map<pair<int,int>,int> mp; signed main() { int h=read(),w=read(),n=read(); REP(i,1,n) { int x=read(),y=read(); REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++; } map<pair<int,int>,int>:: iterator iter; iter=mp.begin(); while(iter!=mp.end()) { ans[iter->second]++; iter++; } int ans0=(h-2)*(w-2); REP(i,1,9) ans0-=ans[i]; printf("%lld\n",ans0); REP(i,1,9) printf("%lld\n",ans[i]); return 0; }
a.cc: In function 'int main()': a.cc:34:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 34 | REP(i,1,n) { | ^ a.cc:8:37: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ a.cc:36:26: error: no matching function for call to 'max(int, long long int)' 36 | REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++; | ~~~^~~~~~~ a.cc:8:39: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ In file included from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:36:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 36 | REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++; | ~~~^~~~~~~ a.cc:8:39: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided a.cc:36:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 36 | REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++; | ^ a.cc:8:37: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ a.cc:36:55: error: no matching function for call to 'max(int, long long int)' 36 | REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++; | ~~~^~~~~~~ a.cc:8:39: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:36:55: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 36 | REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++; | ~~~^~~~~~~ a.cc:8:39: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided a.cc:36:50: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 36 | REP(i,max(1,x-2),min(h-2,x)) REP(j,max(1,y-2),min(w-2,y)) mp[make_pair(i,j)]++; | ^ a.cc:8:37: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ a.cc:48:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 48 | REP(i,1,9) ans0-=ans[i]; | ^ a.cc:8:37: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^ a.cc:51:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 51 | REP(i,1,9) printf("%lld\n",ans[i]); | ^ a.cc:8:37: note: in definition of macro 'REP' 8 | #define REP(i,e,s) for(register int i=e; i<=s; i++) | ^
s548120301
p04000
C++
#include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; 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) #define rng(a) a.begin(),a.end() #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define limit(x,l,r) max(l,min(x,r)) #define lims(x,l,r) (x = max(l,min(x,r))) #define isin(x,l,r) ((l) <= (x) && (x) < (r)) #define pb push_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define uni(x) x.erase(unique(rng(x)),x.end()) #define show(x) cout<<#x<<" = "<<x<<endl; #define PQ(T) priority_queue<T,v(T),greater<T> > #define bn(x) ((1<<x)-1) #define dup(x,y) (((x)+(y)-1)/(y)) #define newline puts("") #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; typedef long long int ll; typedef unsigned uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef set<int> S; typedef queue<int> Q; typedef queue<P> QP; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; inline int in() { int x; scanf("%d",&x); return x;} const ll LINF = 1001002003004005006ll; const int INF = 1001001001; const int MOD = 1000000007; #define dame { puts("-1"); return 0;} #define yn {puts("YES");}else{puts("NO");} int main() { ll H,W,N; cin >> H >> W >> N; vector<ll> ans(10,(ll)0); ans[0] = (ll)(H-2) * (ll)(W-2); map<P,int> mp; rep(i,N) { int a,b; cin >> a >> b; a--; b--; srep(dx,-1,2) { srep(dy,-1,2) { int x = a + dx; int y = b + dy; if(x >= 1 && x < H-1&& y >= 1 && y < W-1) { ans[mp[P(x,y)]]--; mp[P(x,y)]++; ans[mp[P(x,y)]]++; } } } } rep(i,10) { cout << ans[i] << endl; } return 0;
a.cc: In function 'int main()': a.cc:69:12: error: expected '}' at end of input 69 | return 0; | ^ a.cc:43:12: note: to match this '{' 43 | int main() { | ^
s730198162
p04000
C++
#include <bits/stdc++.h> using namespace std; #define ll long long map<pair<int,int>,int>mp; int h,w,n,cnt[10]; int main(){ cin>>h>>w>>n; while(n--){ int x,y;cin>>x>>y; for(int i=max(1,x-2);i<=min(h-2,x);i++)for(int j=max(1,y-2);j<=min(w-2,y);j++)mp[pair<int,int>(i,j)]++; } map<pair<int,int>,int>::tera ter;ter=mp.begin(); while(ter!=mp.end()){ cnt[iter->second]++; ter++; n++; } ll ans=1ll*(h-2)*(w-2); printf("%lld\n",ans-n-1); for(int i=1;i<=9;i++) cout<<cnt[i]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:33: error: 'tera' is not a member of 'std::map<std::pair<int, int>, int>' 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~~ a.cc:12:42: error: 'ter' was not declared in this scope 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~ a.cc:14:21: error: 'iter' was not declared in this scope 14 | cnt[iter->second]++; | ^~~~
s290901427
p04000
C++
#include <bits/stdc++.h> using namespace std; #define ll long long map<pair<int,int>,int>mp; int h,w,n,cnt[10]; int main(){ cin>>h>>w>>n; while(n--){ int x,y;cin>>x>>y; for(int i=max(1,x-2);i<=min(h-2,x);i++)for(int j=max(1,y-2);j<=min(w-2,y);j++)mp[pair<int,int>(i,j)]++; } map<pair<int,int>,int>::tera ter;ter=mp.begin(); while(ter!=mp.end()){ cnt[iter->second]++; ter++; n++; } ll ans=1ll*(h-2)*(w-2); printf("%lld\n",ans-n-1); for(int i=1;i<=9;i++) cout<<cnt[i]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:33: error: 'tera' is not a member of 'std::map<std::pair<int, int>, int>' 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~~ a.cc:12:42: error: 'ter' was not declared in this scope 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~ a.cc:14:21: error: 'iter' was not declared in this scope 14 | cnt[iter->second]++; | ^~~~
s499212156
p04000
C++
#include <bits/stdc++.h> using namespace std; #define ll long long map<pair<int,int>,int>mp; int h,w,n,cnt[10]; int main(){ cin>>h>>w>>n; while(n--){ int x,y;cin>>x>>y; for(int i=max(1,x-2);i<=min(h-2,x);i++)for(int j=max(1,y-2);j<=min(w-2,y);j++)mp[pair<int,int>(i,j)]++; } map<pair<int,int>,int>::tera ter;ter=mp.begin(); while(ter!=mp.end()){ cnt[iter->second]++; ter++; n++; } ll ans=1ll*(h-2)*(w-2); printf("%lld\n",ans-n-1); for(int i=1;i<=9;i++) cout<<cnt[i]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:33: error: 'tera' is not a member of 'std::map<std::pair<int, int>, int>' 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~~ a.cc:12:42: error: 'ter' was not declared in this scope 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~ a.cc:14:21: error: 'iter' was not declared in this scope 14 | cnt[iter->second]++; | ^~~~
s103875521
p04000
C++
#include <bits/stdc++.h> using namespace std; #define ll long long map<pair<int,int>,int>mp; int h,w,n,cnt[10]; int main(){ cin>>h>>w>>n; while(n--){ int x,y;cin>>x>>y; for(int i=max(1,x-2);i<=min(h-2,x);i++)for(int j=max(1,y-2);j<=min(w-2,y);j++)mp[pair<int,int>(i,j)]++; } map<pair<int,int>,int>::tera ter;ter=mp.begin(); while(ter!=mp.end()){ cnt[iter->second]++; ter++; n++; } ll ans=1ll*(h-2)*(w-2); printf("%lld\n",ans-n-1); for(int i=1;i<=9;i++) cout<<cnt[i]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:33: error: 'tera' is not a member of 'std::map<std::pair<int, int>, int>' 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~~ a.cc:12:42: error: 'ter' was not declared in this scope 12 | map<pair<int,int>,int>::tera ter;ter=mp.begin(); | ^~~ a.cc:14:21: error: 'iter' was not declared in this scope 14 | cnt[iter->second]++; | ^~~~
s965992393
p04000
C++
#include<bits/stdc++.h> using namespace std; #define int long long int H,W,N,a,b; set< pair<int,int> > brd; int dem[15]; signed main(){ cin>>H>>W>>N; dem[0]=(H-2)*(W-2); while(N--) { cin>>a>>b; a--;b--; brd.insert({a,b}); for(int x=max((int)0,a-2);x<=min(H-3,a);x++) { for(int y=max((int)0,b-2);y<=min(W-3,b);y++) { int cnt=0; for(int i=x;i<=x+2;i++) { for(int j=y;j<=y+2;j++) { if(brd.count({i,j})) cnt++; } } dem[cnt]++; dem[cnt-1]--; } } } for(int i=0;i<=9;i++) { cout<<dem[i]<<endl; } } a--;b--; brd.insert({a,b}); for(int x=max((int)0,a-2);x<=min(H-3,a);x++) { for(int y=max((int)0,b-2);y<=min(W-3,b);y++) { int cnt=0; for(int i=x;i<=x+2;i++) { for(int j=y;j<=y+2;j++) { if(brd.count({i,j})) cnt++; } } dem[cnt]++; dem[cnt-1]--; } } } for(int i=0;i<=9;i++) { cout<<dem[i]<<endl; } }
a.cc:40:17: error: 'a' does not name a type 40 | a--;b--; | ^ a.cc:40:21: error: 'b' does not name a type 40 | a--;b--; | ^ a.cc:41:17: error: 'brd' does not name a type 41 | brd.insert({a,b}); | ^~~ a.cc:41:33: error: expected unqualified-id before ')' token 41 | brd.insert({a,b}); | ^ a.cc:42:17: error: expected unqualified-id before 'for' 42 | for(int x=max((int)0,a-2);x<=min(H-3,a);x++) | ^~~ a.cc:42:43: error: 'x' does not name a type 42 | for(int x=max((int)0,a-2);x<=min(H-3,a);x++) | ^ a.cc:42:57: error: 'x' does not name a type 42 | for(int x=max((int)0,a-2);x<=min(H-3,a);x++) | ^ a.cc:58:9: error: expected declaration before '}' token 58 | } | ^ a.cc:59:9: error: expected unqualified-id before 'for' 59 | for(int i=0;i<=9;i++) | ^~~ a.cc:59:21: error: 'i' does not name a type 59 | for(int i=0;i<=9;i++) | ^ a.cc:59:26: error: 'i' does not name a type 59 | for(int i=0;i<=9;i++) | ^ a.cc:65:1: error: expected declaration before '}' token 65 | } | ^
s497477215
p04000
C++
#include <bits/stdc++.h> #include <iostream> #include <iomanip> #include <ios> #include <vector> #include <string> #include <algorithm> #include <functional> #include <queue> #include <stack> #include <set> #include <cmath> #include <bitset> #include <map> using namespace std; typedef long long ll; #define mp make_pair; #define pb push_back; #define rep(i,n) for(int i=0;i<n;i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) int main(){ ios::sync_with_stdio(false); cin.tie(0); int H,W,N; cin >> H >> W >> N; pair<ll, ll> cor[N]; ll a[N], b[N]; rep(i,N){ cin >> a[i] >> b[i]; cor[i] = make_pair(a[i], b[i]); } sort(cor, cor+N); // int dx[5]={-2,-1,0,1,2}; // int dy[5]={-2,-1,0,1,2}; int ans[9] ={}; rep(i,N){ int t[5][5]={}; int j=i-1; int tmp; int x=cor[i].first; int y=cor[i].second; while(j>=0){ if(cor[j].first < x-2 || cor[i].first + 2 < x) break; if(cor[j].second >= y-2 && cor[j].second <= y+2){ t[cor[j].first - x +2][cor[j].second - y +2]++; } j--; } j=i+1; while(j<N){ if(cor[j].first < x-2 || x + 2 < cor[j].first) break; if(cor[j].second >= y-2 && cor[j].second <= y+2){ t[cor[j].first - x +2][cor[j].second - y +2]++; } j++; } int tmp[5][5]; rep(k,5)rep(l,5){ if(t[k][l] != 0) ans[t[k][l]]++; } } ll zero=(H-2)*(W-2); rep(i, 9 ){ zero -= ans[i]/(i+1); } cout << zero << endl; rep(i, 9){ cout << ans[i]/(i+1) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:59:9: error: conflicting declaration 'int tmp [5][5]' 59 | int tmp[5][5]; | ^~~ a.cc:41:9: note: previous declaration as 'int tmp' 41 | int tmp; | ^~~
s382076508
p04000
C++
#include<bits/stdc++.h> using namespace std; typedef pair<long, long> P; int binary_search(vector<P> &tmp, long long x, long long y_up, long long y_down){ int ok = (int)tmp.size(); int ng = -1; while (abs(ok - ng) > 1){ int mid = (ok + ng) / 2; if (tmp[mid].first >= x) ok = mid; else ng = mid; } int ok2 = (int)tmp.size(); int ng2 = -1; while (abs(ok2 - ng2) > 1){ int mid = (ok2 + ng2) / 2; if (tmp[mid].first >= x + 1) ok2 = mid; else ng2 = mid; } int ok3 = ok2; int ng3 = ng; while (abs(ok3 - ng3) > 1){ int mid = (ok3 + ng3) / 2; if (tmp[mid].second >= y_up) ok3 = mid; else ng3 = mid; } int ok4 = ok2; int ng4 = ng; while (abs(ok4 - ng4) > 1){ int mid = (ok4 + ng4) / 2; if (tmp[mid].second >= y_donw + 1) ok4 = mid; else ng4 = mid; } return ng4 - ng3; } int main(){ long long h, w, n; cin >> h >> w >> n; vector<P> tmp(n); for (int i = 0; i < n; i++) cin >> tmp[i].first >> tmp[i].second; sort(tmp.begin(), tmp.end()); vector<long long> ans(10, 0); for (int elm = 0; elm < n; elm++){ long long x = tmp[elm].first; long long y = tmp[elm].second; for (int i = - 2; i < 1; i++){ for (int j = -2; j < 1; j++){ if (x + i <= 0 || h < x + i || y + j <= 0 || w < y + j) continue; if (x + i + 2 <= 0 || h < x + i + 2 || y + j + 2 <= 0 || w < y + j + 2) continue; int ss = 0; ss += binary_search(tmp, x + i, y + j, y + j + 2); ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); ans[ss]++; } } } long long tt = 0; for (int i = 1; i < 10; i++){ ans[i] /= i; tt += ans[i]; } ans[0] = (h - 2) * (w - 2) - tt; for (int i = 0; i < 10; i++) cout << ans[i] << endl; }
a.cc: In function 'int binary_search(std::vector<std::pair<long int, long int> >&, long long int, long long int, long long int)': a.cc:32:32: error: 'y_donw' was not declared in this scope; did you mean 'y_down'? 32 | if (tmp[mid].second >= y_donw + 1) ok4 = mid; | ^~~~~~ | y_down
s952687540
p04000
C++
#include<bits/stdc++.h> using namespace std; typedef pair<long, long> P; int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ int ok = (int)tmp.size(); int ng = -1; while (abs(ok - ng) > 1){ int mid = (ok + ng) / 2; if (tmp[mid].first >= x) ok = mid; else ng = mid; } int res = 0; while (tmp[ok].first == x && ok != (int)tmp.size()){ if (y_up <= tmp[ok].second && tmp[ok].second <= y_down) res++; if (y_down < tmp[ok].second) break; ok++; } return res; } int main(){ long long h, w, n; cin >> h >> w >> n; vector<P> tmp(n); for (int i = 0; i < n; i++) cin >> tmp[i].first >> tmp[i].second; sort(tmp.begin(), tmp.end()); vector<long long> ans(10, 0); for (int elm = 0; elm < n; elm++){ long long x = tmp[elm].first; long long y = tmp[elm].second; for (int i = - 2; i < 1; i++){ for (int j = -2; j < 1; j++){ if (x + i <= 0 || h < x + i || y + j <= 0 || w < y + j) continue; if (x + i + 2 <= 0 || h < x + i + 2 || y + j + 2 <= 0 || w < y + j + 2) continue; int ss = 0; ss += binary_search(tmp, x + i, y + j, y + j + 2); ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); ans[ss]++; } } } long long tt = 0; for (int i = 1; i < 10; i++){ ans[i] /= i; tt += ans[i]; } ans[0] = (h - 2) * (w - 2) - tt; for (int i = 0; i < 10; i++) cout << ans[i] << endl; }
a.cc: In function 'int main()': a.cc:40:36: error: no matching function for call to 'binary_search(std::vector<std::pair<long int, long int> >&, long long int, long long int, long long int)' 40 | ss += binary_search(tmp, x + i, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:5: note: candidate: 'int binary_search(std::vector<std::pair<long int, long int> >&, long long int&, long long int&, long long int&)' (near match) 6 | int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ | ^~~~~~~~~~~~~ a.cc:6:5: note: conversion of argument 4 would be ill-formed: a.cc:40:62: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int' 40 | ss += binary_search(tmp, x + i, y + j, y + j + 2); | ~~~~~~^~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)' 2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)' 2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2228:5: note: template argument deduction/substitution failed: a.cc:40:36: note: deduced conflicting types for parameter '_FIter' ('std::vector<std::pair<long int, long int> >' and 'long long int') 40 | ss += binary_search(tmp, x + i, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:41:36: error: no matching function for call to 'binary_search(std::vector<std::pair<long int, long int> >&, long long int, long long int, long long int)' 41 | ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:5: note: candidate: 'int binary_search(std::vector<std::pair<long int, long int> >&, long long int&, long long int&, long long int&)' (near match) 6 | int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ | ^~~~~~~~~~~~~ a.cc:6:5: note: conversion of argument 4 would be ill-formed: a.cc:41:66: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int' 41 | ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)' 2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)' 2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2228:5: note: template argument deduction/substitution failed: a.cc:41:36: note: deduced conflicting types for parameter '_FIter' ('std::vector<std::pair<long int, long int> >' and 'long long int') 41 | ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:42:36: error: no matching function for call to 'binary_search(std::vector<std::pair<long int, long int> >&, long long int, long long int, long long int)' 42 | ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:5: note: candidate: 'int binary_search(std::vector<std::pair<long int, long int> >&, long long int&, long long int&, long long int&)' (near match) 6 | int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ | ^~~~~~~~~~~~~ a.cc:6:5: note: conversion of argument 4 would be ill-formed: a.cc:42:66: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int' 42 | ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)' 2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)' 2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2228:5: note: template argument deduction/substitution failed: a.cc:42:36: note: deduced conflicting types for parameter '_FIter' ('std::vector<std::pair<long int, long int> >' and 'long long int') 42 | ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s483496514
p04000
C++
#include<bits/stdc++.h> using namespace std; typedef pair<long, long> P; int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ int ok = (int)tmp.size(); int ng = -1; while (abs(ok - ng) > 1){ int mid = (ok + ng) / 2; if (tmp[mid].first >= x) ok = mid; else ng = mid; } int res = 0; while (tmp[ok].first == x && ok != (int)tmp.size()){ if (y_up <= tmp[ok].second && tmp[ok].second <= y_down) res++; ok++; } return res; } int main(){ long long h, w, n; cin >> h >> w >> n; vector<P> tmp(n); for (int i = 0; i < n; i++) cin >> tmp[i].first >> tmp[i].second; sort(tmp.begin(), tmp.end()); vector<long long> ans(10, 0); for (int elm = 0; elm < n; elm++){ long long x = tmp[elm].first; long long y = tmp[elm].second; for (int i = - 2; i < 1; i++){ for (int j = -2; j < 1; j++){ if (x + i <= 0 || h < x + i || y + j <= 0 || w < y + j) continue; if (x + i + 2 <= 0 || h < x + i + 2 || y + j + 2 <= 0 || w < y + j + 2) continue; int ss = 0; ss += binary_search(tmp, x + i, y + j, y + j + 2); ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); ans[ss]++; } } } long long tt = 0; for (int i = 1; i < 10; i++){ ans[i] /= i; tt += ans[i]; } ans[0] = (h - 2) * (w - 2) - tt; for (int i = 0; i < 10; i++) cout << ans[i] << endl; }
a.cc: In function 'int main()': a.cc:39:36: error: no matching function for call to 'binary_search(std::vector<std::pair<long int, long int> >&, long long int, long long int, long long int)' 39 | ss += binary_search(tmp, x + i, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:5: note: candidate: 'int binary_search(std::vector<std::pair<long int, long int> >&, long long int&, long long int&, long long int&)' (near match) 6 | int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ | ^~~~~~~~~~~~~ a.cc:6:5: note: conversion of argument 4 would be ill-formed: a.cc:39:62: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int' 39 | ss += binary_search(tmp, x + i, y + j, y + j + 2); | ~~~~~~^~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)' 2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)' 2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2228:5: note: template argument deduction/substitution failed: a.cc:39:36: note: deduced conflicting types for parameter '_FIter' ('std::vector<std::pair<long int, long int> >' and 'long long int') 39 | ss += binary_search(tmp, x + i, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:40:36: error: no matching function for call to 'binary_search(std::vector<std::pair<long int, long int> >&, long long int, long long int, long long int)' 40 | ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:5: note: candidate: 'int binary_search(std::vector<std::pair<long int, long int> >&, long long int&, long long int&, long long int&)' (near match) 6 | int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ | ^~~~~~~~~~~~~ a.cc:6:5: note: conversion of argument 4 would be ill-formed: a.cc:40:66: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int' 40 | ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)' 2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)' 2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2228:5: note: template argument deduction/substitution failed: a.cc:40:36: note: deduced conflicting types for parameter '_FIter' ('std::vector<std::pair<long int, long int> >' and 'long long int') 40 | ss += binary_search(tmp, x + i + 1, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:41:36: error: no matching function for call to 'binary_search(std::vector<std::pair<long int, long int> >&, long long int, long long int, long long int)' 41 | ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:6:5: note: candidate: 'int binary_search(std::vector<std::pair<long int, long int> >&, long long int&, long long int&, long long int&)' (near match) 6 | int binary_search(vector<P> &tmp, long long &x, long long &y_up, long long &y_down){ | ^~~~~~~~~~~~~ a.cc:6:5: note: conversion of argument 4 would be ill-formed: a.cc:41:66: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int' 41 | ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)' 2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 4 provided /usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)' 2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:2228:5: note: template argument deduction/substitution failed: a.cc:41:36: note: deduced conflicting types for parameter '_FIter' ('std::vector<std::pair<long int, long int> >' and 'long long int') 41 | ss += binary_search(tmp, x + i + 2, y + j, y + j + 2); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s697832843
p04000
C++
#include <iostream> #include <vector> #include <map> using namespace std; int main(void) { int num, a, b, i, k = 0, sum = 0; long long H, W, ss; cin >> H >> W >> num; ss = (H - 2) * (W - 2); vector<pair<int, int>> list(9 * num); vector<int> ans(10, 0); map<pair<int, int>, int> mp; pair<int, int> p; for (i = 0; i < num; i++) { scanf_s("%d%d", &a, &b); for (int j = -1; j < 2; j++) { for (int l = -1; l < 2; l++) { p = make_pair(a + j, b + l); if (mp[p] == 0) list[k++] = p; mp[p]++; } } } for (i = 0; i < 9 * num; i++) { if (list[i].first > 1 && list[i].first < H && list[i].second > 1 && list[i].second < W) { ans[mp[list[i]]]++; sum++; } } cout << ss - sum << "\n"; for (i = 1; i < 10; i++) cout << ans[i] << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:17:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 17 | scanf_s("%d%d", &a, &b); | ^~~~~~~ | scanf
s981887124
p04000
C++
#include <iostream> #include <vector> #include <set> #include <algorithm> #include <math.h> #include <string.h> using namespace std; int main() { long long int H, W, N; cin >> H >> W >> N; map<pair<long long int, long long int>, long long int>MLL; for( int i = 0; i < N; i++ ) { long long int a, b; cin >> a >> b; a--; b--; for( int j = -1; j <= 1; j++ ) { for( int k = -1; k <= 1; k++ ) { MLL[make_pair( a + j, b + k )]++; } } } vector<long long int>ans( 10 ); for( auto n : MLL ) { if( 1 <= n.first.first&&n.first.first < H - 1 && 1 <= n.first.second&&n.first.second < W - 1 ) { ans[n.second]++; } } ans[0] = (H - 2)*(W - 2); for( size_t i = 1; i < 10; i++ ) { ans[0] -= ans[i]; } for( size_t i = 0; i < 10; i++ ) { cout << ans[i] << endl; } }
a.cc: In function 'int main()': a.cc:11:9: error: 'map' was not declared in this scope 11 | map<pair<long long int, long long int>, long long int>MLL; | ^~~ a.cc:7:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>' 6 | #include <string.h> +++ |+#include <map> 7 | using namespace std; a.cc:11:47: error: expected primary-expression before ',' token 11 | map<pair<long long int, long long int>, long long int>MLL; | ^ a.cc:11:49: error: expected primary-expression before 'long' 11 | map<pair<long long int, long long int>, long long int>MLL; | ^~~~ a.cc:18:33: error: 'MLL' was not declared in this scope 18 | MLL[make_pair( a + j, b + k )]++; | ^~~ a.cc:23:23: error: 'MLL' was not declared in this scope 23 | for( auto n : MLL ) { | ^~~
s994077991
p04000
C++
#include <iostream> #include <map> #include <utility> using namespace std; int main(){ long H,W,N; scanf("%ld",&H); scanf("%ld",&W); scanf("%ld",&N); std::map<pair<int, int>, long> m; // Create grid mappings for(long h=1 ; h<=H-2 ; h++){ for(long w=1 ; w<=W-2 ; w++){ m[make_pair(h,w)] = 0; } } long x,y; for(long i=0 ; i<N ; i++){ scanf("%ld %ld",&x,&y); for(int x_offset = -1 ; x_offset<=1 ; x_offset++){ for(int y_offset = -1 ; y_offset<=1 ; y_offset++){ if(x+x_offset>=2 && y+y_offset>=2 && x+x_offset<=H-1 && y+y_offset<=W-1){ m[make_pair(x+x_offset, y+y_offset)]+=1; } } } } long count[10] = {0}; count[0]=(H-2)*(W-2); for(auto elem:m){ count[m.second]++; count[0]--; } for(int i=0; i<10;i++){ cout << count[i] << endl; } }
a.cc: In function 'int main()': a.cc:40:25: error: 'class std::map<std::pair<int, int>, long int>' has no member named 'second' 40 | count[m.second]++; | ^~~~~~
s318638241
p04000
C++
#include <bits/stdc++.h> using namespace std; namespace std { template <> class hash<pair<int64_t, int64_t>> { public: size_t operator()(const pair<int64_t, int64_t>& d) const { return hash<int64_t>()(d.first) + hash<int64_t>()(d.second); } }; } // namespace std int64_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int64_t h, w, n; cin >> h >> w >> n; unordered_map<pair<int64_t, int64_t>, int64_t> pieces; for (int64_t i = 0; i < n; ++i) { int64_t a, b; cin >> a >> b; for (int64_t x = 0; x < 3; ++x) { for (int64_t y = 0; y < 3; ++y) { auto p = make_pair(b - x, a - y); if (p.first < 1 || p.second < 1 || w - 2 < p.first || h - 2 < p.second) { continue; } pieces[p] += 1; } } } vector<int64_t> ans(10); int64_t whites = (w - 2) * (h - 2); for (auto& e : pieces) { ans[e.second]++; } for (auto& elm : ans) { whites -= elm; } ans[0] = whites; for (auto& elm : ans) { cout << elm << "\n"; } cout << "\n"; }
a.cc:15:1: error: '::main' must return 'int' 15 | int64_t main() { | ^~~~~~~
s588650663
p04000
C++
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; const int maxn=1000007,p1=100007,p2=10007; int vis[1000010]; long long cou[12]; int n,bux[9]={-2,-2,-2,-1,-1,-1,0,0,0},buy[9]={-1,-2,0,-1,-2,0,-1,-2,0}; long long h,w; char ch; inline int get_num(){ int num=0;ch=getchar(); while(ch>'9'||ch<'0'){ch=getchar(); } while(ch<='9'&&ch>='0'){num=(num<<3)+(num<<1)+ch-'0';ch=getchar(); } return num; } int hash(int a,int b){ long long ans=((a*p1)%maxn+(b*p2)%maxn)%maxn; return ans; } void work(int x,int y){ int nowx,nowy; long long node; for(int i=0;i<9;i++){ nowx=x+bux[i],nowy=y+buy[i]; if(nowx>0&&nowx<=h-2&&nowy>0&&nowy<=w-2){ node=hash(nowx,nowy); cou[vis[node]]--;cou[++vis[node]]++; } } } int main(){ int a,b; memset(cou,0,sizeof(cou)); memset(vis,0,sizeof(vis)); scanf("%d%d%d",&h,&w,&n); cou[0]=(h-2)*(w-2); for(int i=1;i<=n;i++){ a=get_num();b=get_num(); work(a,b); } for(int i=0;i<=9;i++)printf("%d\n",cou[i]); return 0; }
a.cc: In function 'void work(int, int)': a.cc:28:30: error: reference to 'hash' is ambiguous 28 | node=hash(nowx,nowy); | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:18:5: note: 'int hash(int, int)' 18 | int hash(int a,int b){ | ^~~~
s333894329
p04000
C++
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; const int maxn=1000007,p1=100007,p2=10007; int vis[1000010]; long long cou[12]; int n,bux[9]={-2,-2,-2,-1,-1,-1,0,0,0},buy[9]={-1,-2,0,-1,-2,0,-1,-2,0}; long long h,w; char ch; inline int get_num(){ int num=0;ch=getchar(); while(ch>'9'||ch<'0'){ch=getchar(); } while(ch<='9'&&ch>='0'){num=(num<<3)+(num<<1)+ch-'0';ch=getchar(); } return num; } int hash(int a,int b){ long long ans=((a*p1)%maxn+(b*p2)%maxn)%maxn; return ans; } void work(int x,int y){ int nowx,nowy,node; for(int i=0;i<9;i++){ nowx=x+bux[i],nowy=y+buy[i]; if(nowx>0&&nowx<=h-2&&nowy>0&&nowy<=w-2){ node=hash(nowx,nowy); cou[vis[node]]--;cou[++vis[node]]++; } } } int main(){ int a,b; memset(cou,0,sizeof(cou)); memset(vis,0,sizeof(vis)); scanf("%d%d%d",&h,&w,&n); cou[0]=(h-2)*(w-2); for(int i=1;i<=n;i++){ a=get_num();b=get_num(); work(a,b); } for(int i=0;i<=9;i++)printf("%d\n",cou[i]); return 0; }
a.cc: In function 'void work(int, int)': a.cc:27:30: error: reference to 'hash' is ambiguous 27 | node=hash(nowx,nowy); | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:18:5: note: 'int hash(int, int)' 18 | int hash(int a,int b){ | ^~~~
s992645754
p04000
C++
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #include<queue> #include<stack> using namespace std; const int maxn=1000007,p1=100007,p2=10007; int vis[1000010]; long long cou[12]; int n,bux[9]={-2,-2,-2,-1,-1,-1,0,0,0},buy[9]={-1,-2,0,-1,-2,0,-1,-2,0}; long long h,w; char ch; inline int get_num(){ int num=0;ch=getchar(); while(ch>'9'||ch<'0'){ch=getchar(); } while(ch<='9'&&ch>='0'){num=(num<<3)+(num<<1)+ch-'0';ch=getchar(); } return num; } int hash(int a,int b){ long long ans=((a*p1)%maxn+(b*p2)%maxn)%maxn; return ans; } void work(int x,int y){ int nowx,nowy,node; for(int i=0;i<9;i++){ nowx=x+bux[i],nowy=y+buy[i]; if(nowx>0&&nowx<=h-2&&nowy>0&&nowy<=w-2){ node=hash(nowx,nowy); cou[vis[node]]--;cou[++vis[node]]++; } } } int main(){ int a,b; memset(cou,0,sizeof(cou)); memset(vis,0,sizeof(vis)); scanf("%d%d%d",&h,&w,&n); cou[0]=(h-2)*(w-2); for(int i=1;i<=n;i++){ a=get_num();b=get_num(); work(a,b); } for(int i=0;i<=9;i++)printf("%d\n",cou[i]); return 0; }
a.cc: In function 'void work(int, int)': a.cc:30:30: error: reference to 'hash' is ambiguous 30 | node=hash(nowx,nowy); | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:21:5: note: 'int hash(int, int)' 21 | int hash(int a,int b){ | ^~~~
s303315996
p04000
C++
#include<iostream> #include<cstdio> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; const long long hash=456123; long long hashx[10000007]; long long ans[10000007]; int dx[9]={-2,-2,-2,-1,-1,-1,0,0,0}; int dy[9]={-2,-1,0,-2,-1,0,-2,-1,0}; int tot; int main() { long long H,W,N; cin>>H>>W>>N; long long ans0=(H-2)*(W-2); for(int i=0;i<N;i++) { int x,y; cin>>x>>y; for(int j=0;j<9;j++) { int xx=x+dx[j]; int yy=y+dy[j]; if(xx>=1&&xx<=H-2&&yy>=1&&yy<=W-2) { hashx[tot++] =xx*hash+yy; } } } sort(hashx,hashx+tot); int cnt=1; for(int i=0;i<tot;i++) { if(hashx[i]==hashx[i+1]) cnt++; else { ans[cnt]++; cnt=1; ans0--; } } cout<<ans0<<endl; for(int i=1;i<10;i++) cout<<ans[i]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:50: error: reference to 'hash' is ambiguous 29 | hashx[tot++] =xx*hash+yy; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:8:17: note: 'const long long int hash' 8 | const long long hash=456123; | ^~~~
s710250422
p04000
C++
#include<bits/stdc++.h> using namespace std; const long long hash=456123; long long hashx[10000007]; long long ans[10000007]; int dx[9]={-2,-2,-2,-1,-1,-1,0,0,0}; int dy[9]={-2,-1,0,-2,-1,0,-2,-1,0}; int tot; int main() { long long H,W,N; cin>>H>>W>>N; long long ans0=(H-2)*(W-2); for(int i=0;i<N;i++) { int x,y; cin>>x>>y; for(int j=0;j<9;j++) { int xx=x+dx[j]; int yy=y+dy[j]; if(xx>=1&&xx<=H-2&&yy>=1&&yy<=W-2) { hashx[tot++] =xx*hash+yy; } } } sort(hashx,hashx+tot); int cnt=1; for(int i=0;i<tot;i++) { if(hashx[i]==hashx[i+1]) cnt++; else { ans[cnt]++; cnt=1; ans0--; } } cout<<ans0<<endl; for(int i=1;i<10;i++) cout<<ans[i]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:24:50: error: reference to 'hash' is ambiguous 24 | hashx[tot++] =xx*hash+yy; | ^~~~ In file included from /usr/include/c++/14/string_view:50, 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, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:3:17: note: 'const long long int hash' 3 | const long long hash=456123; | ^~~~
s832810955
p04000
C++
#include <bits/stdc++.h> using namespace std; a,b,H,W; int64_t cnt[10]; map<pair<int64_t, int64_t>, int64_t> mp; int N,i,j,k; int64_t sm; int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); cin>>H>>W>>N; for(i=0;i<N;i++){ cin>>a>>b; a--;b--; for(j=-2;j<=0;j++){ for(k=-2;k<=0;k++){ if(a+j<0 || a+j+2>H-1 || b+k<0 || b+k+2>W-1)continue; mp[make_pair(a+j, b+k)]++; } } } sm = (H - 2) * (W - 2); for(auto itr=mp.begin(); itr!=mp.end();++itr){ for(i=1;i<=9;i++){ if((itr->second)==i)cnt[i]++; } } for(i=1;i<=9;i++){ sm-=cnt[i]; } cnt[0]=sm; for(i=0;i<=9;i++)cout<<cnt[i]<<endl; return 0; }
a.cc:4:2: error: 'a' does not name a type 4 | a,b,H,W; | ^ a.cc: In function 'int main()': a.cc:16:8: error: 'H' was not declared in this scope 16 | cin>>H>>W>>N; | ^ a.cc:16:11: error: 'W' was not declared in this scope 16 | cin>>H>>W>>N; | ^ a.cc:18:10: error: 'a' was not declared in this scope 18 | cin>>a>>b; | ^ a.cc:18:13: error: 'b' was not declared in this scope 18 | cin>>a>>b; | ^
s415659170
p04000
C++
#include <bits/stdc++.h> using namespace std; ll a,b,H,W; ll cnt[10]; map<pair<ll, ll>, ll> mp; int N,i,j,k; ll sm; int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); cin>>H>>W>>N; for(i=0;i<N;i++){ cin>>a>>b; a--;b--; for(j=-2;j<=0;j++){ for(k=-2;k<=0;k++){ if(a+j<0 || a+j+2>H-1 || b+k<0 || b+k+2>W-1)continue; mp[make_pair(a+j, b+k)]++; } } } sm = (H - 2) * (W - 2); for(auto itr=mp.begin(); itr!=mp.end();++itr){ for(i=1;i<=9;i++){ if((itr->second)==i)cnt[i]++; } } for(i=1;i<=9;i++){ sm-=cnt[i]; } cnt[0]=sm; for(i=0;i<=9;i++)cout<<cnt[i]<<endl; return 0; }
a.cc:4:1: error: 'll' does not name a type 4 | ll a,b,H,W; | ^~ a.cc:5:1: error: 'll' does not name a type 5 | ll cnt[10]; | ^~ a.cc:6:10: error: 'll' was not declared in this scope 6 | map<pair<ll, ll>, ll> mp; | ^~ a.cc:6:14: error: 'll' was not declared in this scope 6 | map<pair<ll, ll>, ll> mp; | ^~ a.cc:6:16: error: template argument 1 is invalid 6 | map<pair<ll, ll>, ll> mp; | ^ a.cc:6:16: error: template argument 2 is invalid a.cc:6:19: error: 'll' was not declared in this scope 6 | map<pair<ll, ll>, ll> mp; | ^~ a.cc:6:21: error: template argument 1 is invalid 6 | map<pair<ll, ll>, ll> mp; | ^ a.cc:6:21: error: template argument 2 is invalid a.cc:6:21: error: template argument 3 is invalid a.cc:6:21: error: template argument 4 is invalid a.cc:8:1: error: 'll' does not name a type 8 | ll sm; | ^~ a.cc: In function 'int main()': a.cc:16:8: error: 'H' was not declared in this scope 16 | cin>>H>>W>>N; | ^ a.cc:16:11: error: 'W' was not declared in this scope 16 | cin>>H>>W>>N; | ^ a.cc:18:10: error: 'a' was not declared in this scope 18 | cin>>a>>b; | ^ a.cc:18:13: error: 'b' was not declared in this scope 18 | cin>>a>>b; | ^ a.cc:27:3: error: 'sm' was not declared in this scope; did you mean 'tm'? 27 | sm = (H - 2) * (W - 2); | ^~ | tm a.cc:28:19: error: request for member 'begin' in 'mp', which is of non-class type 'int' 28 | for(auto itr=mp.begin(); itr!=mp.end();++itr){ | ^~~~~ a.cc:28:36: error: request for member 'end' in 'mp', which is of non-class type 'int' 28 | for(auto itr=mp.begin(); itr!=mp.end();++itr){ | ^~~ a.cc:30:27: error: 'cnt' was not declared in this scope; did you mean 'int'? 30 | if((itr->second)==i)cnt[i]++; | ^~~ | int a.cc:34:9: error: 'cnt' was not declared in this scope; did you mean 'int'? 34 | sm-=cnt[i]; | ^~~ | int a.cc:36:3: error: 'cnt' was not declared in this scope; did you mean 'int'? 36 | cnt[0]=sm; | ^~~ | int
s606975016
p04000
C++
// // Created by Tzyark on 2018/9/18. // #include <iostream> #include <vector> using namespace std; typedef long long ll; int H, W, N, a, b; ll ans[10]; vector<pair<int, int>> vec; int main() { cin >> H >> W >> N; for (int n = 0; n < N; n++) { cin >> a >> b; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (1 <= a-i && a-i <= H-2 && 1 <= b-j && b-j <= W-2) { vec.push_back(make_pair(a-i, b-j)); } } } } sort(vec.begin(), vec.end()); int cnt = 1; for (int i = 0; i < vec.size(); i++) { if (vec[i] == vec[i + 1]) cnt++; else ans[cnt]++, cnt = 1; } ans[0] = 1ll * (H-2) * (W-2); for (int i = 1; i <= 9; i++) { ans[0] -= ans[i]; } for (int i = 0; i <= 9; i++) { cout << ans[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'short'? 23 | sort(vec.begin(), vec.end()); | ^~~~ | short
s489605471
p04000
C++
#include<bits/stdc++.h> //Ithea Myse Valgulious namespace chtholly{//这里快读快写有30多行,我就省略了. using namespace std; const int yuzu=1e5; typedef pair<int,int> pii; map<pii,int> mp; int h=read(),w=read(),n=read(),cnt[10]; int main(){ int i,j; for (;n--;){ int x=read(),y=read(); for (i=max(1,x-2);i<=min(h-2,x);++i){ for (j=max(1,y-2);j<=min(w-2,y);++j){ mp[pii(i,j)]++; } } } for (auto p:mp) cnt[p.second]++,n++; ll ans=1ll*(h-2)*(w-2); write(ans-n-1),pl; for (i=1;i<=9;++i) write(cnt[i]),pl; }
a.cc:7:11: error: too few arguments to function 'ssize_t read(int, void*, size_t)' 7 | int h=read(),w=read(),n=read(),cnt[10]; | ~~~~^~ 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: In function 'int chtholly::main()': a.cc:11:7: error: 'n' was not declared in this scope 11 | for (;n--;){ | ^ a.cc:12:13: error: too few arguments to function 'ssize_t read(int, void*, size_t)' 12 | int x=read(),y=read(); | ~~~~^~ /usr/include/unistd.h:371:16: note: declared here 371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur | ^~~~ a.cc:14:18: error: 'y' was not declared in this scope 14 | for (j=max(1,y-2);j<=min(w-2,y);++j){ | ^ a.cc:14:30: error: 'w' was not declared in this scope 14 | for (j=max(1,y-2);j<=min(w-2,y);++j){ | ^ a.cc:19:17: error: 'cnt' was not declared in this scope; did you mean 'int'? 19 | for (auto p:mp) cnt[p.second]++,n++; | ^~~ | int a.cc:19:33: error: 'n' was not declared in this scope 19 | for (auto p:mp) cnt[p.second]++,n++; | ^ a.cc:20:1: error: 'll' was not declared in this scope 20 | ll ans=1ll*(h-2)*(w-2); | ^~ a.cc:21:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 21 | write(ans-n-1),pl; | ^~~ | abs a.cc:21:11: error: 'n' was not declared in this scope 21 | write(ans-n-1),pl; | ^ a.cc:21:16: error: 'pl' was not declared in this scope 21 | write(ans-n-1),pl; | ^~ a.cc:22:26: error: 'cnt' was not declared in this scope; did you mean 'int'? 22 | for (i=1;i<=9;++i) write(cnt[i]),pl; | ^~~ | int a.cc:23:1: warning: no return statement in function returning non-void [-Wreturn-type] 23 | } | ^ a.cc: At global scope: a.cc:23:2: error: expected '}' at end of input 23 | } | ^ a.cc:2:19: note: to match this '{' 2 | namespace chtholly{//这里快读快写有30多行,我就省略了. | ^
s348561090
p04000
C++
/* goes here */ #include<bits/stdc++.h> //1 using namespace std; //2 typedef signed long long ll; //3 #define INF 0x3f3f3f3f //4 vector<pair<long long, long long>> rekkyo; //1 #define int ll //2 bool isvalid (ll i, ll j, ll h, ll w) { //3 if(i<0 || h<=i || j<0 || w<=j){ //4 return false; //1 } return true; //2 } signed main(void){ //3 int H,W,N; //4 cin >> H >> W >> N; //1 int a[114514],b[114514]; //2 for (ll i = 0; i < N; i++) { //3 cin>>a[i]>>b[i]; //4 for(int j = 0; j < 3; ++j){ //1 for(int k=0;k<3;++k){ //2 if (!j && !k) {a[i]--; b[i]--;} //3 ; //4 } //1 } //2 for (ll j = -1; j <= +1; j++) { //3 int c; //4 for(ll k = -1; k <= +1; ++k)if(isvalid(a[i] + j - 1, b[i] + k - 1, H, W) && isvalid(a[i] + j + 1, b[i] + k + 1, H, W))rekkyo.emplace_back(a[i] + j, b[i] + k); //1 †悪魔的行為† } //2 if ("POKAIKO" == "RYONAIKO") std::sort( //3 rekkyo.begin(),rekkyo.end()); //4 } //1 int Ans[10]={}; //2 while (!rekkyo.empty()) { //3 break;} //4 //pair<long long, long long> i, previous; //1 for(int j=0;j<rekkyo.size();j++){ //2 ll k; for (k = j; k < rekkyo.size() && rekkyo[k] == rekkyo[j]; k++); //3 } //4 for(auto i : rekkyo){ //1 } //2 ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 ll samepunch; //4 break;}map<pair<long long, long long>, long long> taplis; //1 for(auto i : rekkyo){ //2 if (taplis.find(i) == taplis.end()) taplis.insert( //3 make_pair(i,0)); //4 ++taplis[i]; //1 } //2 Ans[0] = H * W - taplis.size(); //3 for(pair<pair<long long,long long>,long long> PP:taplis){ //4 ++Ans[PP.second]; //1 ; //2 } Ans[0] = (H - 2) * (W - 2); for (ll viine = 1; viine <= 9; viine++) { //3 Ans[0]-=Ans[viine]; //4 } for(auto i : Ans)cout << i << endl; //1 int Gabriel,Satanichia,Raphiel; //2 char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 return 0
a.cc: In function 'int main()': a.cc:56:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^~~~~~~~~~~ a.cc:57:13: error: expected ';' at end of input 57 | return 0 | ^ | ; a.cc:57:13: error: expected '}' at end of input a.cc:12:20: note: to match this '{' 12 | } signed main(void){ //3 | ^
s361988476
p04000
C++
/* goes here */ #include<bits/stdc++.h> //1 using namespace std; //2 typedef signed long long ll; //3 #define INF 0x3f3f3f3f //4 vector<pair<long long, long long>> rekkyo; //1 #define int ll //2 bool isvalid (ll i, ll j, ll h, ll w) { //3 if(i<0 || h<=i || j<0 || w<=j){ //4 return false; //1 } return true; //2 } signed main(void){ //3 int H,W,N; //4 cin >> H >> W >> N; //1 int a[114514],b[114514]; //2 for (ll i = 0; i < N; i++) { //3 cin>>a[i]>>b[i]; //4 for(int j = 0; j < 3; ++j){ //1 for(int k=0;k<3;++k){ //2 if (!j && !k) {a[i]--; b[i]--;} //3 ; //4 } //1 } //2 for (ll j = -1; j <= +1; j++) { //3 int c; //4 for(ll k = -1; k <= +1; ++k)if(isvalid(a[i] + j - 1, b[i] + k - 1, H, W) && isvalid(a[i] + j + 1, b[i] + k + 1, H, W))rekkyo.emplace_back(a[i] + j, b[i] + k); //1 †悪魔的行為† } //2 if ("POKAIKO" == "RYONAIKO") std::sort( //3 rekkyo.begin(),rekkyo.end()); //4 } //1 int Ans[10]={}; //2 while (!rekkyo.empty()) { //3 break;} //4 //pair<long long, long long> i, previous; //1 for(int j=0;j<rekkyo.size();j++){ //2 ll k; for (k = j; k < rekkyo.size() && rekkyo[k] == rekkyo[j]; k++); //3 } //4 for(auto i : rekkyo){ //1 } //2 ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 ll samepunch; //4 break;}map<pair<long long, long long>, long long> taplis; //1 for(auto i : rekkyo){ //2 if (taplis.find(i) == taplis.end()) taplis.insert( //3 make_pair(i,0)); //4 ++taplis[i]; //1 } //2 Ans[0] = H * W - taplis.size(); //3 for(pair<pair<long long,long long>,long long> PP:taplis){ //4 ++Ans[PP.second]; //1 ; //2 } Ans[0] = (H - 2) * (W - 2); for (ll viine = 1; viine <= 9; viine++) { //3 Ans[0]-=Ans[i]; //4 } for(auto i : Ans)cout << i << endl; //1 int Gabriel,Satanichia,Raphiel; //2 char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 return 0; //4 } // 1 end
a.cc: In function 'int main()': a.cc:53:21: error: 'i' was not declared in this scope 53 | Ans[0]-=Ans[i]; //4 | ^ a.cc:56:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^~~~~~~~~~~
s851801893
p04000
C++
/* goes here */ #include<bits/stdc++.h> //1 using namespace std; //2 typedef signed long long ll; //3 #define INF 0x3f3f3f3f //4 vector<pair<long long, long long>> rekkyo; //1 #define int ll //2 bool isvalid (ll i, ll j, ll h, ll w) { //3 if(i<0 || h<=i || j<0 || w<=j){ //4 return false; //1 } return true; //2 } signed main(void){ //3 int H,W,N; //4 cin >> H >> W >> N; //1 int a[114514],b[114514]; //2 for (ll i = 0; i < N; i++) { //3 cin>>a[i]>>b[i]; //4 for(int j = 0; j < 3; ++j){ //1 for(int k=0;k<3;++k){ //2 if (!j && !k) {a[i]--; b[i]--;} //3 ; //4 } //1 } //2 for (ll j = -1; j <= +1; j++) { //3 int c; //4 for(ll k = -1; k <= +1; ++k)if(isvalid(a[i] + j - 1, b[i] + k - 1, H, W) && isvalid(a[i] + j + 1, b[i] + k + 1, H, W))rekkyo.emplace_back(a[i] + j, b[i] + k); //1 †悪魔的行為† } //2 if ("POKAIKO" == "RYONAIKO") std::sort( //3 rekkyo.begin(),rekkyo.end()); //4 } //1 int Ans[10]={}; //2 while (!rekkyo.empty()) { //3 break;} //4 //pair<long long, long long> i, previous; //1 for(int j=0;j<rekkyo.size();j++){ //2 ll k; for (k = j; k < rekkyo.size() && rekkyo[k] == rekkyo[j]; k++); //3 } //4 for(auto i : rekkyo){ //1 } //2 ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 ll samepunch; //4 break;}map<pair<long long, long long>, long long> taplis; //1 for(auto i : rekkyo){ //2 if (taplis.find(i) == taplis.end()) taplis.insert( //3 i); //4 ++taplis[i]; //1 } //2 Ans[0] = H * W - taplis.size(); //3 for(pair<pair<long long,long long>,long long> PP:taplis){ //4 ++Ans[PP.second]; //1 ; //2 } Ans[0] = (H - 2) * (W - 2); for (ll viine = 1; viine <= 9; viine++) { //3 Ans[0]-=Ans[i]; //4 } for(auto i : Ans)cout << i << endl; //1 int Gabriel,Satanichia,Raphiel; //2 char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 return 0; //4 } // 1 end
a.cc: In function 'int main()': a.cc:44:54: error: no matching function for call to 'std::map<std::pair<long long int, long long int>, long long int>::insert(std::pair<long long int, long long int>&)' 44 | if (taplis.find(i) == taplis.end()) taplis.insert( //3 | ~~~~~~~~~~~~~^~~~~ 45 | i); //4 | ~~ In file included from /usr/include/c++/14/map:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152, from a.cc:2: /usr/include/c++/14/bits/stl_map.h:847:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Val>, _Pair>::value), std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator, bool> > std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >]' 847 | insert(_Pair&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:847:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, 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/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::__enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::pair<std::_Rb_tree_iterator<std::pair<const std::pair<long long int, long long int>, long long int> >, bool>]': /usr/include/c++/14/bits/stl_map.h:847:2: required by substitution of 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const std::pair<long long int, long long int>, long long int>, _Pair>::value), std::pair<std::_Rb_tree_iterator<std::pair<const std::pair<long long int, long long int>, long long int> >, bool> > std::map<std::pair<long long int, long long int>, long long int>::insert(_Pair&&) [with _Pair = std::pair<long long int, long long int>&]' a.cc:44:54: required from here 44 | if (taplis.find(i) == taplis.end()) taplis.insert( //3 | ~~~~~~~~~~~~~^~~~~ 45 | i); //4 | ~~ /usr/include/c++/14/type_traits:138:11: error: no type named 'type' in 'struct std::enable_if<false, std::pair<std::_Rb_tree_iterator<std::pair<const std::pair<long long int, long long int>, long long int> >, bool> >' 138 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_map.h:924:9: note: candidate: 'template<class _Pair> std::__enable_if_t<((bool)std::is_constructible<std::pair<const _Key, _Val>, _Pair>::value), typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, _Pair&&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >]' 924 | insert(const_iterator __position, _Pair&& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:924:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_map.h:942:9: note: candidate: 'template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >]' 942 | insert(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:942:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_map.h:661:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::insert_return_type std::map<_Key, _Tp, _Compare, _Alloc>::insert(node_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; insert_return_type = std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, long long int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> > >::insert_return_type; node_type = std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, long long int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> > >::node_type]' 661 | insert(node_type&& __nh) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:661:26: note: no known conversion for argument 1 from 'std::pair<long long int, long long int>' to 'std::map<std::pair<long long int, long long int>, long long int>::node_type&&' {aka 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, long long int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> > >::node_type&&'} 661 | insert(node_type&& __nh) | ~~~~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_map.h:666:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(const_iterator, node_type&&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; iterator = std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, long long int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> > >::iterator; const_iterator = std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, long long int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> > >::const_iterator; node_type = std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, long long int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> > >::node_type]' 666 | insert(const_iterator __hint, node_type&& __nh) | ^~~~~~ /usr/include/c++/14/bits/stl_map.h:666:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_map.h:834:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(const value_type&) [with _Key = std::pair<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; typename std::_Rb_tree<_Key, std::pair<const _Key, _Val>, std::_Select1st<std::pair<const _Key, _Val> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other>::iterator = std::_Rb_tree<std::pair<long long int, long long int>, std::pair<const std::pair<long long int, long long int>, long long int>, std::_Select1st<std::pair<const std::pair<long long int, long long int>, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> > >::iterator; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> >::other = std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >; typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Val> > = __gnu_cxx::__alloc_traits<std::allocator<std::pair<const std::pair<long long int, long long int>, long long int> >, std::pair<const std::pair<long long int, long long int>, long long int> >::rebind<std::pair<const std::pair<long long int, long long int>, long long int> >; typename _Allocator::value_type = std::pair<const std::pair<long long int, long long int>, long long int>; value_type = std::pair<const std::pair<long long int, long long int>, long long int>]' 834 | insert(const value_type& __x) |
s685359991
p04000
C++
/* goes here */ #include<bits/stdc++.h> //1 using namespace std; //2 typedef signed long long ll; //3 #define INF 0x3f3f3f3f //4 vector<pair<long long, long long>> rekkyo; //1 #define int ll //2 bool isvalid (ll i, ll j, ll h, ll w) { //3 if(i<0 || h<=i || j<0 || w<=j){ //4 return false; //1 } return true; //2 } signed main(void){ //3 int H,W,N; //4 cin >> H >> W >> N; //1 int a[114514],b[114514]; //2 for (ll i = 0; i < N; i++) { //3 cin>>a[i]>>b[i]; //4 for(int j = 0; j < 3; ++j){ //1 for(int k=0;k<3;++k){ //2 if (!j && !k) {a[i]--; b[i]--;} //3 ; //4 } //1 } //2 for (ll j = -1; j <= +1; j++) { //3 int c; //4 for(ll k = -1; k <= +1; ++k)if(isvalid(a[i] + j - 1, b[i] + k - 1, H, W) && isvalid(a[i] + j + 1, b[i] + k + 1, H, W))rekkyo.emplace_back(a[i] + j, b[i] + k); //1 †悪魔的行為† } //2 std::sort( //3 rekkyo.begin(),rekkyo.end()); //4 } //1 int Ans[10]={}; //2 while (!rekkyo.empty()) { //3 break;} //4 pair<long long, long long> i, previous; //1 for(int j=0;j<rekkyo.size();j++){ //2 ll k; for (k = j; k < rekkyo.size() && rekkyo[k] == rekkyo[j]; k++); //3 } //4 for(i : rekkyo){ //1 } //2 ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 ll samepunch; //4 break;}map<pair<long long, long long>, long long> taplis; //1 for(i : rekkyo){ //2 if (taplis.find(i) == taplis.end()) taplis.insert( //3 i); //4 ++taplis[i]; //1 } //2 Ans[0] = H * W - taplis.size(); //3 for(pair<pair<long long,long long>,long long> PP:taplis){ //4 ++Ans[PP.second]; //1 ; //2 } Ans[0] = (H - 2) * (W - 2); for (ll viine = 1; viine <= 9; viine++) { //3 Ans[0]-=Ans[i]; //4 } for(auto i : Ans)cout << i << endl; //1 int Gabriel,Satanichia,Raphiel; //2 char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 return 0; //4 } // 1 end
a.cc: In function 'int main()': a.cc:38:11: error: found ':' in nested-name-specifier, expected '::' 38 | for(i : rekkyo){ //1 | ^ | :: a.cc:38:9: error: 'i' is not a class, namespace, or enumeration 38 | for(i : rekkyo){ //1 | ^ a.cc:40:21: error: expected ';' before ',' token 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^ | ; a.cc:40:21: error: expected primary-expression before ',' token a.cc:40:23: error: 'sameend' was not declared in this scope 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^~~~~~~ a.cc:40:30: error: expected ')' before ';' token 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^ | ) a.cc:38:8: note: to match this '(' 38 | for(i : rekkyo){ //1 | ^ a.cc:40:39: error: 'samebegin' was not declared in this scope 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^~~~~~~~~ a.cc:43:11: error: found ':' in nested-name-specifier, expected '::' 43 | for(i : rekkyo){ //2 | ^ | :: a.cc:43:9: error: 'i' is not a class, namespace, or enumeration 43 | for(i : rekkyo){ //2 | ^ a.cc:49:5: error: expected primary-expression before 'for' 49 | for(pair<pair<long long,long long>,long long> PP:taplis){ //4 | ^~~ a.cc:48:36: error: expected ')' before 'for' 48 | Ans[0] = H * W - taplis.size(); //3 | ^ | ) 49 | for(pair<pair<long long,long long>,long long> PP:taplis){ //4 | ~~~ a.cc:43:8: note: to match this '(' 43 | for(i : rekkyo){ //2 | ^ a.cc:53:20: error: no match for 'operator[]' (operand types are 'll [10]' {aka 'long long int [10]'} and 'std::pair<long long int, long long int>') 53 | Ans[0]-=Ans[i]; //4 | ^ a.cc:56:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^~~~~~~~~~~
s650726177
p04000
C++
/* goes here */ #include<bits/stdc++.h> //1 using namespace std; //2 typedef signed long long ll; //3 #define INF 0x3f3f3f3f //4 vector<pair<long long, long long>> rekkyo; //1 #define int ll; //2 bool isvalid (ll i, ll j, ll h, ll w) { //3 if(i<0 || h<=i || j<0 || w<=j){ //4 return false; //1 } return true; //2 } signed main(void){ //3 int H,W,N; //4 cin >> H >> W >> N; //1 int a[114514],b[114514]; //2 for (ll i = 0; i < N; i++) { //3 cin>>a[i]>>b[i]; //4 for(int j = 0; j < 3; ++j){ //1 for(int k=0;k<3;++k){ //2 if (!j && !k) {a[i]--; b[i]--;} //3 ; //4 } //1 } //2 for (ll j = -1; j <= +1; j++) { //3 int c; //4 for(ll k = -1; k <= +1; ++k)if(isvalid(a[i] + j - 1, b[i] + k - 1, H, W) && isvalid(a[i] + j + 1, b[i] + k + 1, H, W))rekkyo.emplace_back(a[i] + j, b[i] + k); //1 †悪魔的行為† } //2 std::sort( //3 rekkyo.begin(),rekkyo.end()); //4 } //1 int Ans[10]={}; //2 while (!rekkyo.empty()) { //3 break;} //4 pair<long long, long long> i, previous; //1 for(int j=0;j<rekkyo.size();j++){ //2 ll k; for (k = j; k < rekkyo.size() && rekkyo[k] == rekkyo[j]; k++); //3 } //4 for(i : rekkyo){ //1 } //2 ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 ll samepunch; //4 break;}map<pair<long long, long long>, long long> taplis; //1 for(i : rekkyo){ //2 if (taplis.find(i) == taplis.end()) taplis.insert( //3 i); //4 ++taplis[i]; //1 } //2 Ans[0] = H * W - taplis.size(); //3 for(pair<pair<long long,long long>,long long> PP:taplis){ //4 ++Ans[PP.second]; //1 ; //2 } Ans[0] = (H - 2) * (W - 2); for (ll viine = 1; viine <= 9; viine++) { //3 Ans[0]-=Ans[i]; //4 } for(auto i : Ans)cout << i << endl; //1 int Gabriel,Satanichia,Raphiel; //2 char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 return 0; //4 } // 1 end
a.cc: In function 'int main()': a.cc:7:13: error: declaration does not declare anything [-fpermissive] 7 | #define int ll; //2 | ^~ a.cc:13:5: note: in expansion of macro 'int' 13 | int H,W,N; //4 | ^~~ a.cc:13:9: error: 'H' was not declared in this scope 13 | int H,W,N; //4 | ^ a.cc:13:11: error: 'W' was not declared in this scope 13 | int H,W,N; //4 | ^ a.cc:13:13: error: 'N' was not declared in this scope 13 | int H,W,N; //4 | ^ a.cc:7:13: error: declaration does not declare anything [-fpermissive] 7 | #define int ll; //2 | ^~ a.cc:15:5: note: in expansion of macro 'int' 15 | int a[114514],b[114514]; //2 | ^~~ a.cc:15:9: error: 'a' was not declared in this scope 15 | int a[114514],b[114514]; //2 | ^ a.cc:15:19: error: 'b' was not declared in this scope 15 | int a[114514],b[114514]; //2 | ^ a.cc:7:13: error: declaration does not declare anything [-fpermissive] 7 | #define int ll; //2 | ^~ a.cc:18:13: note: in expansion of macro 'int' 18 | for(int j = 0; j < 3; ++j){ //1 | ^~~ a.cc:18:17: error: 'j' was not declared in this scope 18 | for(int j = 0; j < 3; ++j){ //1 | ^ a.cc:18:29: error: expected ')' before ';' token 18 | for(int j = 0; j < 3; ++j){ //1 | ~ ^ | ) a.cc:18:33: error: 'j' was not declared in this scope 18 | for(int j = 0; j < 3; ++j){ //1 | ^ a.cc:7:13: error: declaration does not declare anything [-fpermissive] 7 | #define int ll; //2 | ^~ a.cc:25:13: note: in expansion of macro 'int' 25 | int c; //4 | ^~~ a.cc:25:17: error: 'c' was not declared in this scope 25 | int c; //4 | ^ a.cc:7:13: error: declaration does not declare anything [-fpermissive] 7 | #define int ll; //2 | ^~ a.cc:31:5: note: in expansion of macro 'int' 31 | int Ans[10]={}; //2 | ^~~ a.cc:31:9: error: 'Ans' was not declared in this scope 31 | int Ans[10]={}; //2 | ^~~ a.cc:7:13: error: declaration does not declare anything [-fpermissive] 7 | #define int ll; //2 | ^~ a.cc:35:9: note: in expansion of macro 'int' 35 | for(int j=0;j<rekkyo.size();j++){ //2 | ^~~ a.cc:35:13: error: 'j' was not declared in this scope 35 | for(int j=0;j<rekkyo.size();j++){ //2 | ^ a.cc:35:32: error: expected ')' before ';' token 35 | for(int j=0;j<rekkyo.size();j++){ //2 | ~ ^ | ) a.cc:35:33: error: 'j' was not declared in this scope 35 | for(int j=0;j<rekkyo.size();j++){ //2 | ^ a.cc:38:11: error: found ':' in nested-name-specifier, expected '::' 38 | for(i : rekkyo){ //1 | ^ | :: a.cc:38:9: error: 'i' is not a class, namespace, or enumeration 38 | for(i : rekkyo){ //1 | ^ a.cc:40:21: error: expected ';' before ',' token 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^ | ; a.cc:40:21: error: expected primary-expression before ',' token a.cc:40:23: error: 'sameend' was not declared in this scope 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^~~~~~~ a.cc:40:30: error: expected ')' before ';' token 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^ | ) a.cc:38:8: note: to match this '(' 38 | for(i : rekkyo){ //1 | ^ a.cc:40:39: error: 'samebegin' was not declared in this scope 40 | ll samebegin = 0, sameend; while (samebegin < rekkyo.size()) { //3 | ^~~~~~~~~ a.cc:43:11: error: found ':' in nested-name-specifier, expected '::' 43 | for(i : rekkyo){ //2 | ^ | :: a.cc:43:9: error: 'i' is not a class, namespace, or enumeration 43 | for(i : rekkyo){ //2 | ^ a.cc:49:5: error: expected primary-expression before 'for' 49 | for(pair<pair<long long,long long>,long long> PP:taplis){ //4 | ^~~ a.cc:48:36: error: expected ')' before 'for' 48 | Ans[0] = H * W - taplis.size(); //3 | ^ | ) 49 | for(pair<pair<long long,long long>,long long> PP:taplis){ //4 | ~~~ a.cc:43:8: note: to match this '(' 43 | for(i : rekkyo){ //2 | ^ a.cc:7:13: error: declaration does not declare anything [-fpermissive] 7 | #define int ll; //2 | ^~ a.cc:55:5: note: in expansion of macro 'int' 55 | int Gabriel,Satanichia,Raphiel; //2 | ^~~ a.cc:55:9: error: 'Gabriel' was not declared in this scope 55 | int Gabriel,Satanichia,Raphiel; //2 | ^~~~~~~ a.cc:55:17: error: 'Satanichia' was not declared in this scope 55 | int Gabriel,Satanichia,Raphiel; //2 | ^~~~~~~~~~ a.cc:55:28: error: 'Raphiel' was not declared in this scope 55 | int Gabriel,Satanichia,Raphiel; //2 | ^~~~~~~ a.cc:56:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^~~~~~~~~~~ a.cc:7:15: error: expected primary-expression before ';' token 7 | #define int ll; //2 | ^ a.cc:56:48: note: in expansion of macro 'int' 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^~~ a.cc:7:15: error: expected ')' before ';' token 7 | #define int ll; //2 | ^ a.cc:56:48: note: in expansion of macro 'int' 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^~~ a.cc:56:47: note: to match this '(' 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^ a.cc:56:51: error: expected primary-expression before ')' token 56 | char* ukuku09 = "Ukunichia"; Satanichia = (int)ukuku09; //3 | ^
s469827723
p04000
C++
#include <iostream> #include <cstdint> #include <unordered_map> #include <algorithm> #include <array> std::uint_fast64_t make_key(const std::int_fast64_t y, const std::int_fast64_t x) { return (static_cast<std::uint_fast64_t>(y) << 32u) | static_cast<std::uint_fast64_t>(x); } int main() { std::int_fast64_t h, w, n; std::cin >> h >> w >> n; std::unordered_map<std::uint_fast64_t, std::int_fast64_t> sparse_grid; for (std::int_fast64_t i = 0; i < n; ++i) { std::int_fast64_t a, b; std::cin >> a >> b; for (std::int_fast64_t y = std::max<std::int_fast64_t>(a - 1, 2); y <= std::min<std::int_fast64_t>(a + 1, h - 1); ++y) { for (std::int_fast64_t x = std::max<std::int_fast64_t>(b - 1, 2); x <= std::min<std::int_fast64_t>(b + 1, w - 1); ++x) { ++sparse_grid[make_key(y, x)]; } } } std::array<std::int_fast64_t, 10> results = {0}; for (const auto& kv : sparse_grid) { ++results[kv.second]; } results[0] = (h - 2) * (w - 2) - std::accumulate(results.begin() + 1, results.end(), 0, [](const std::int_fast64_t sum, const std::int_fast64_t x) { return sum + x; }); for (const std::int_fast64_t& result : results) { std::cout << result << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:30:41: error: 'accumulate' is not a member of 'std' 30 | results[0] = (h - 2) * (w - 2) - std::accumulate(results.begin() + 1, results.end(), 0, [](const std::int_fast64_t sum, const std::int_fast64_t x) { return sum + x; }); | ^~~~~~~~~~
s622986844
p04000
C++
#include<cstdio> #include<map> using namespace std; #define LL long long LL H,W,N; LL ans[10]; LL dx[]={-2,-2,-2,-1,-1,-1,0,0,0}; LL dy[]={-2,-1,0,-2,-1,0,-2,-1,0}; map<LL,LL> m; void slove(LL x,LL y) { LL a,b; LL id; for(int i=0;i<9;i++){ a=x+dx[i]; b=y+dy[i]; if(a<1 || b<1 || a>H-2 || b>W-2) continue; id=(H-2)*(b-1)+a;//对每个小矩形进行编号 //左上角的位置就只能在(h-2)*(w-2)的矩形区域内 //每一行有w-2个元素 a-1 m[id]++; } } int main(){ LL x,y; scanf("%lld %lld %lld",&H,&W,&N); for(int i=1;i<=N;i++) { scanf("%lld %lld",&x,&y); slove(x,y); } ans[0]=(H-2)*(W-2);//总数 LL temp; map<LL,LL>::iterator it=m.begin(); for(it=m.begin();it!=m.end();it++){ temp=it->second; ans[temp]++; ans[0]--; } for(int i=0;i<=9;i++) cout<<ans[i]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:41:9: error: 'cout' was not declared in this scope 41 | cout<<ans[i]<<endl; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<map> +++ |+#include <iostream> 3 | using namespace std; a.cc:41:23: error: 'endl' was not declared in this scope 41 | cout<<ans[i]<<endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<map> +++ |+#include <ostream> 3 | using namespace std;
s089480202
p04000
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1000000000; const ll LINF = (ll) 4000000000000000000; const ll MOD = (ll) 1000000007; const double PI = acos(1.0); const int limit = 100010; #define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i) #define rep(i,n) REP(i, 0, n) #define MP make_pair #define YES(n) cout << ((n) ? "YES" : "NO") << endl #define Yes(n) cout << ((n) ? "Yes" : "No") << endl #define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl #define NP(v) next_permutation(v.begin(),v.end()) #define smaller_queue priority_queue <ll, vector<ll>, greater<ll> > //------------------------------------------------------ struct pos { ll y, x; }; int main() { vector<pos> around; for (ll i = -1; i <= 1; i++) for (ll j = -1; j <= 1; j++) around.push_back({i, j}); ll h, w, n; cin >> h >> w >> n; unordered_map<pos, bool> mp; set<pos> check; rep(i, n) { ll a, b; cin >> a >> b; mp[{a, b}] = true; for (auto c : around) check.insert({a + c.y, b + c.x}); } ll ans[10] = {}; ll black_any = 0; for (auto itr = check.begin(); itr != check.end(); ++itr) { pos p = *itr; if (p.y - 1 < 0 || p.y + 1 >= h || p.x - 1 < 0 || p.x + 1 >= w) continue; black_any++; ll cnt = 0; for (auto c : around) if (mp [{p.y + c.y, p.x + c.x}]) cnt++; if (cnt > 0) ans[cnt]++; } ans[0] = (h - 2)*(w - 2) - black_any; rep(i, 10) cout << ans[i] << endl; return 0; }
a.cc: In function 'int main()': a.cc:36:30: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = pos; _Tp = bool; _Hash = std::hash<pos>; _Pred = std::equal_to<pos>; _Alloc = std::allocator<std::pair<const pos, bool> >]' 36 | unordered_map<pos, bool> mp; | ^~ In file included from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = pos; _Tp = bool; _Hash = std::hash<pos>; _Pred = std::equal_to<pos>; _Alloc = std::allocator<std::pair<const pos, bool> >]' is implicitly deleted because the default definition would be ill-formed: 148 | unordered_map() = default; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_map.h: At global scope: /usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = pos; _Value = std::pair<const pos, bool>; _Alloc = std::allocator<std::pair<const pos, bool> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<pos>; _Hash = std::hash<pos>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/unordered_map.h:33: /usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = pos; _Value = std::pair<const pos, bool>; _Alloc = std::allocator<std::pair<const pos, bool> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<pos>; _Hash = std::hash<pos>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = pos; _Value = std::pair<const pos, bool>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<pos>; _Hash = std::hash<pos>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/hashtable.h:35: /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = pos; _Value = std::pair<const pos, bool>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<pos>; _Hash = std::hash<pos>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = pos; _Value = std::pair<const pos, bool>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<pos>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' /usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<pos>]': /usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<pos>::hash()' 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ In file included from /usr/include/c++/14/string_view:50, 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/bits/functional_hash.h:102:12: note: 'std::hash<pos>::hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<pos, false>::__hash_enum()' /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = pos; bool <anonymous> = false]' 83 | __hash_enum(__hash_enum&&); | ^~~~~~~~~~~ /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = pos; bool <anonymous> = false]' is private within this context 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = pos; _Value = std::pair<const pos, bool>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<pos>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed: 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<pos>, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<pos>, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed: 1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<pos>::~hash()' /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<pos>::~hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = pos; bool <anonymous> = false]' is private within this context /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<pos, std::pair<const pos, bool>, std::__detail::_Select1st, std::hash<pos>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' /usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<pos, std::pair<const pos, bool>, std::__detail::_Select1st, std::hash<pos>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed: 1306 | struct _Hash_code_base | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<pos>, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<pos, std::pair<const pos, bool>, std::__detail::_Select1st, std::equal_to<pos>, std::hash<pos>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable_base()' /usr/include/c++/14/bits/hashtable_policy.h:1688:12: note: 'std::__detail::_Hashtable_base<pos, std::pair<const pos, bool>, std::__detail::_Select1st, std::equal_to<pos>, std::hash<pos>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable_base()' is implicitly deleted because the default definition would be ill-formed: 1688 | struct _Hashtable_base | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1688:12
s301522715
p04000
C++
// ConsoleApplication56.cpp : アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" #include<cstring> #include<algorithm> #include<cmath> #include<string> #include<iostream> #include<vector> #include<utility> using namespace std; int main() { int ans[10] = {}; long long int i, j, k, l, m, n, s,H,W,N; long long int sum,cc,cnt; cc = 0; cnt = 1; cin >> H >> W >> N; vector<long long int>a(N); vector<long long int>b(N); pair<long long int,long long int>P[900000]; for (i = 0; i < N; i++) { cin >> a[i]>>b[i]; for (j = -2; j <= 0; j++) { for (k = -2; k <= 0; k++) { if (a[i] + j >= 0 && b[i] + k >= 0&&a[i]+j+2<=H&&b[i]+k+2<=W) { P[cc].first = a[i] + j; P[cc].second = b[i] + k; cc++; } } } } sort(P,P+cc-1); pair<long long int, long long int>temp; temp.first = P[0].first; temp.second = P[0].second; for (i = 1; i < cc; i++) { if (temp.first == P[i].first&&temp.second == P[i].second) { cnt++; } else { temp.first = P[i].first; temp.second = P[i].second; ans[cnt]++; cnt = 1; } } for (i = 1; i <= 9; i++) { cout << ans[i] << endl; } return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s896483915
p04000
C
import static java.util.function.Function.*; import static java.util.stream.Collectors.*; import java.util.*; public class Main { public void main(Scanner sc) { int h = sc.nextInt(); int w = sc.nextInt(); int n = sc.nextInt(); Map<String, Integer> map = new HashMap<>(); for (int i = 0; i < n; i++) { int a = sc.nextInt(); int b = sc.nextInt(); for (int j = a - 2; j <= a; j++) { if (j <= 0 || j > h - 2) { continue; } for (int k = b - 2; k <= b; k++) { if (k <= 0 || k > w - 2) { continue; } map.compute(j + "," + k, (p, v) -> (v == null) ? 1 : v + 1); } } } System.out.println(((long) h - 2) * ((long) w - 2) - map.size()); Map<Integer, Long> countMap = map.values().stream().collect(groupingBy(identity(), counting())); for (int i = 1; i <= 9; i++) { System.out.println(countMap.getOrDefault(i, 0L)); } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); new Main().main(sc); sc.close(); } }
main.c:1:7: error: expected ';' before 'static' 1 | import static java.util.function.Function.*; | ^~~~~~~ | ; main.c:1:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import static java.util.function.Function.*; | ^ main.c:2:7: error: expected ';' before 'static' 2 | import static java.util.stream.Collectors.*; | ^~~~~~~ | ; main.c:2:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | import static java.util.stream.Collectors.*; | ^ main.c:4:1: error: unknown type name 'import' 4 | import java.util.*; | ^~~~~~ main.c:4:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 4 | import java.util.*; | ^ main.c:6:1: error: unknown type name 'public' 6 | public class Main { | ^~~~~~ main.c:6:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main' 6 | public class Main { | ^~~~
s426932038
p04000
C++
#include <iostream> #include <utility> #include <vector> #include <algorithm> using namespace std; const long Max_h = 1000000000; const long Max_w = 1000000000; const int Max_n = 100000; long a[Max_n]; // y long b[Max_n]; // x pair<long,long> p[Max_n]; int main() { int index = 0; long count_array[16] = {0}; long H, W, N; cin >> H >> W >> N; for (long i = 0; i < N; i++) { cin >> a[i] >> b[i]; } // end input for (long i = 0; i < N; i++) { for (int j = -2; j <= 0; j++) { // たて for (int k = -2; k <= 0; k++) { // よこ long tmp_x = a[i]+k-1, tmp_y = b[i]+j-1; if (tmp_x < 0 || tmp_y < 0 || tmp_x >= H-2 || tmp_y >= W-2) continue; p[index++] = make_pair(tmp_x, tmp_y); } } } // pairに格納完了 // pairのソート sort(p, p+index); // for (int i = 0; i < index; i++) cout << "=" << p[i].first << " " << p[i].second << \ endl; /* ライブラリを使う */ vector<pair<long,long> > p2; for (int i = 0; i < index; i++) p2[i] = p[i]; decltype(p2)::iterator result = unique(p2.begin(),p2.end()); //p2 = unique(p2,p2+index); for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { count_array[count(p,p+index,p2[i])]++; } long sum = 0; for (int i = 1; i < 10; i++) { sum += count_array[i]; } count_array[0] = (H-2)*(W-2)-sum; for (int i = 0; i < 10; i++) { cout << i << ": " << count_array[i] << endl; } }
a.cc: In function 'int main()': a.cc:43:48: error: conversion from 'std::vector<std::pair<long int, long int> >::iterator' to non-scalar type 'std::vector<std::pair<long int, long int>*>' requested 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ~~~~~~~~^~ a.cc:43:56: error: no match for 'operator!=' (operand types are 'std::vector<std::pair<long int, long int>*>' and 'std::vector<std::pair<long int, long int> >::iterator') 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ~~~ ^~ ~~~~~~~~ | | | | | std::vector<std::pair<long int, long int> >::iterator | std::vector<std::pair<long int, long int>*> In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::fpos<_StateT>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::allocator<_CharT>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::reverse_iterator<_Iterator>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::reverse_iterator<_Iterator>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::move_iterator<_IteratorL>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::move_iterator<_IteratorL>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::pair<_T1, _T2>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/string_view:658: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> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/string_view:666: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>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:43:66: note: '__gnu_cxx::__normal_iterator<std::pair<long int, long int>*, std::vector<std::pair<long int, long int> > >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:43:66: note: 'std::vector<std::pair<long int, long int>*>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:43:66: note: mismatched types 'const _CharT*' and 'std::vector<std::pair<long int, long int>*>' 43 | for (vector<pair<long,long>* > itr = p2.begin(); itr != p2.end(); itr++) { | ^ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860
s307034195
p04000
C++
#include <iostream> #include <map> using namespace std; typedef long long ll; int main(){ ll i,j,k; ll a,b,c; ll h,w,n; cin>>h>>w>>n; map<pair<int,int>,int> cnt; for(i=0;i<n;i++){ cin>>a>>b; for(j=-1;j<=1;j++){ for(k=-1;k<=1;k++){ if(a+j>=1 && a+j<=h && b+k>=1 && b+j<=w){ cnt[make_pair(a+j,b+k)]++; } } } } ll ans[10]; fill(a,a+10,0ll); ans[0]=(h-2)*(w-2); for(auto& elem : cnt){ ans[0]--; ans[elem.second]++; } for(i=0;i<=9;i++){ cout<<ans[i]<<endl; } return 0; }
In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = long long int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]': /usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int; _Tp = long long int]' 998 | { std::__fill_a1(__first, __last, __value); } | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = long long int]' 1029 | std::__fill_a(__first, __last, __value); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:27:6: required from here 27 | fill(a,a+10,0ll); | ~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'long long int') 952 | *__first = __tmp; | ^~~~~~~~
s918294728
p04000
C++
#include <iostream> #include <map> using namespace std; typedef long long ll; int main(){ ll i,j,k; ll a,b,c; ll h,w,n; cin>>h>>w>>n; map<pair<int,int>,int> cnt; for(i=0;i<n;i++){ cin>>a>>b; for(j=-1;j<=1;j++){ for(k=-1;k<=1;k++){ if(a+j>=1 && a+j<=h && b+k>=1 && b+j<=w){ cnt[make_pair(a+j,b+k)]++; } } } } ll ans[10]; fill(a,a+10,0); ans[0]=(h-2)*(w-2); for(auto& elem : cnt){ ans[0]--; ans[elem.second]++; } for(i=0;i<=9;i++){ cout<<ans[i]<<endl; } return 0; }
In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]': /usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int; _Tp = int]' 998 | { std::__fill_a1(__first, __last, __value); } | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int]' 1029 | std::__fill_a(__first, __last, __value); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:27:6: required from here 27 | fill(a,a+10,0); | ~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'long long int') 952 | *__first = __tmp; | ^~~~~~~~
s847750640
p04000
C++
#include <iostream> #include <map> using namespace std; typedef long long ll; ll i,j,k; ll a,b,c; ll h,w,n; int main(){ cin>>h>>w>>n; map<pair<int,int>,int> cnt; for(i=0;i<n;i++){ cin>>a>>b; for(j=-1;j<=1;j++){ for(k=-1;k<=1;k++){ if(a+j>=1 && a+j<=h && b+k>=1 && b+j<=w){ cnt[make_pair(a+j,b+k)]++; } } } } ll ans[10]; fill(a,a+10,0); ans[0]=(h-2)*(w-2); for(auto& elem : cnt){ ans[0]--; ans[elem.second]++; } for(i=0;i<=9;i++){ cout<<ans[i]<<endl; } return 0; }
In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]': /usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int; _Tp = int]' 998 | { std::__fill_a1(__first, __last, __value); } | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int]' 1029 | std::__fill_a(__first, __last, __value); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:26:6: required from here 26 | fill(a,a+10,0); | ~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'long long int') 952 | *__first = __tmp; | ^~~~~~~~
s026436121
p04000
C++
#include <iostream> #include <map> using namespace std; typedef long long ll; ll i,j,k; ll a,b,c; ll ans=0; ll h,w,n; int main(){ cin>>h>>w>>n; map<pair<int,int>,int> cnt; for(i=0;i<n;i++){ cin>>a>>b; for(j=-1;j<=1;j++){ for(k=-1;k<=1;k++){ if(a+j>=1 && a+j<=h && b+k>=1 && b+j<=w){ cnt[make_pair(a+j,b+k)]++; } } } } ll ans[10]; fill(a,a+10,0); ans[0]=(h-2)*(w-2); for(auto elem : cnt){ ans[0]--; ans[elem.second]++; } for(i=0;i<=9;i++){ cout<<ans[i]<<endl; } return 0; }
In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]': /usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int; _Tp = int]' 998 | { std::__fill_a1(__first, __last, __value); } | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int]' 1029 | std::__fill_a(__first, __last, __value); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:27:6: required from here 27 | fill(a,a+10,0); | ~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'long long int') 952 | *__first = __tmp; | ^~~~~~~~
s845546277
p04000
C++
#include <iostream> #include <climits> #include <stack> #include <queue> #include <string> #include <random> #include <utility> #include <cmath> #include <set> #include <map> #include <string.h> #include <iomanip> #include <stdlib.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする vector<int> G[100005]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; std::vector<P> tree[100010]; struct edge{int to,cost;}; ll i,j,k; ll a,b,c; ll ans=0; ll h,w,n; int main(){ cin>>h>>w>>n; map<pair<int,int>,int> cnt; for(i=0;i<n;i++){ cin>>a>>b; for(j=-1;j<=1;j++){ for(k=-1;k<=1;k++){ if(a+j>=1 && a+j<=h && b+k>=1 && b+j<=w){ cnt[make_pair(a+j,b+k)]++; } } } } ll ans[10]; fill(a,a+10,0); ans[0]=(h-2)*(w-2); for(auto elem : cnt){ ans[0]--; ans[elem.second]++; } for(i=0;i<=9;i++){ cout<<ans[i]<<endl; } return 0; }
In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]': /usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int; _Tp = int]' 998 | { std::__fill_a1(__first, __last, __value); } | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int]' 1029 | std::__fill_a(__first, __last, __value); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:52:6: required from here 52 | fill(a,a+10,0); | ~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'long long int') 952 | *__first = __tmp; | ^~~~~~~~
s698501405
p04000
C++
#include <iostream> #include <climits> #include <stack> #include <queue> #include <string> #include <random> #include <utility> #include <cmath> #include <set> #include <map> #include <string.h> #include <iomanip> #include <stdlib.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする struct edge{int to,cost;}; vector<int> G[100005]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; std::vector<P> tree[100010]; ll i,j,k; ll a,b,c; ll ans=0; ll h,w,n; int main(){ cin>>h>>w>>n; map<pair<int,int>,int> cnt; for(i=0;i<n;i++){ cin>>a>>b; for(j=-1;j<=1;j++){ for(k=-1;k<=1;k++){ if(a+j>=1 && a+j<=h && b+k>=1 && b+j<=w){ cnt[make_pair(a+j,b+k)]++; } } } } ll ans[10]; fill(a,a+10,0); ans[0]=(h-2)*(w-2); for(auto& elem : cnt){ ans[0]--; ans[elem.second]++; } for(i=0;i<=9;i++){ cout<<ans[i]<<endl; } return 0; }
In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]': /usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long long int; _Tp = int]' 998 | { std::__fill_a1(__first, __last, __value); } | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long long int; _Tp = int]' 1029 | std::__fill_a(__first, __last, __value); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:51:6: required from here 51 | fill(a,a+10,0); | ~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'long long int') 952 | *__first = __tmp; | ^~~~~~~~
s089421206
p04000
C++
#include <bits/stdc++.h> #define F first #define S second using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef pair<int, int> ii; typedef vector<ii> vii; unordered_map<ii, int> MAP, visited; vi ans(10); ll h, w; void visit(ii v) { if (visited[v] || v.F <= 0 || v.S <= 0 || v.F > h-2 || v.S > w-2) return; visited[v] = 1; int cnt = 0; for (int i = 0; i <= 2; ++i) { for (int j = 0; j <= 2; ++j) { cnt += MAP[ii(i + v.F, j + v.S)]; } } if (cnt) { ans[0]++; ans[cnt]++; } } void process(ii v) { for (int i = 0; i <= 2; ++i) { for (int j = 0; j <= 2; ++j) { visit(ii(v.F - i, v.S - j)); } } } int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> h >> w >> n; vii V(n); for (int i = 0; i < n; ++i) { cin >> V[i].F >> V[i].S; MAP[V[i]] = 1; } for (int i = 0; i < n; ++i) { process(V[i]); } cout << (h-2)*(w-2) - ans[0] << "\n"; for (int i = 1; i <= 9; ++i) { cout << ans[i] << "\n"; } return 0; }
a.cc:12:24: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' 12 | unordered_map<ii, int> MAP, visited; | ^~~ In file included from /usr/include/c++/14/unordered_map:41, from /usr/include/c++/14/functional:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' is implicitly deleted because the default definition would be ill-formed: 148 | unordered_map() = default; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/unordered_map.h:33: /usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' In file included from /usr/include/c++/14/bits/hashtable.h:35: /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed: 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' /usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]': /usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()' 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ In file included from /usr/include/c++/14/string_view:50, 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/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()' /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]' 83 | __hash_enum(__hash_enum&&); | ^~~~~~~~~~~ /usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates 1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { } | ^~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed: 1328 | _Hash_code_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed: 1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()' /usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed: 102 | struct hash : __hash_enum<_Tp> | ^~~~ /usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context /usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here 84 | ~__hash_enum(); | ^ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 1731 | _Hashtable_base() = default; | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' /usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed: 1306 | struct _Hash_code_base | ^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' /usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates 539 | _Hashtable() = default; | ^~~~~~~~~~ /usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<const std::pair<int, in
s445764986
p04000
C++
from collections import Counter H,W,N = map(int, input().split()) ddx = [0,0,0,1,1,1,-1,-1,-1] ddy = [-1,0,1,-1,0,1,-1,0,1] cnt = [] for _ in range(N): y, x = map(int, input().split()) for dx, dy in zip(ddx, ddy): yy = y + dy xx = x + dx if 1 < xx < W and 1 < yy < H: cnt.append(yy * W + xx) cnt = Counter(cnt) #print(cnt) ans = [0] * 10 ans[0] = (H-2)*(W-2) for k in cnt: c = cnt[k] ans[c] += 1 ans[0] -= 1 for i in ans: print(i)
a.cc:18:2: error: invalid preprocessing directive #print 18 | #print(cnt) | ^~~~~ a.cc:1:1: error: 'from' does not name a type 1 | from collections import Counter | ^~~~
s100451068
p04000
C++
aa
a.cc:1:1: error: 'aa' does not name a type 1 | aa | ^~
s705505528
p04000
C++
#include<bits/stdc++.h> using namespace std; map<pair<int,int>,int>M; vector<pair<int,int>>vec,vec2; int H,W,n,a,b; long long cnt1[10]; void valid(int x,int y){if(x<0 || x>=H-2 || y<0 || y>=W-2){return false;}return true;} int main(){ cin>>H>>W>>n; for(int i=0;i<n;i++){ cin>>a>>b;a--;b--;M[make_pair(a,b)]=1; for(int j=-2;j<=2;j++){for(int k=-2;k<=2;k++)vec.push_back(make_pair(a+j,b+k);)} } sort(vec.begin(),vec.end()); if(valid(vec[0].first,vec[0].second)==true)vec2.push_back(vec[0]); for(int i=1;i<vec.size();i++){ if(vec[i-1]!=vec[i]){ if(valid(vec[i].first,vec[i].second)==true)vec2.push_back(vec[i]); } } for(int i=0;i<vec2.size();i++){ int cnts=0; for(int j=0;j<3;j++){for(int k=0;k<3;k++)cnts+=M[make_pair(vec2[i].first+j,vec2[i].second+k)];} cnt1[cnts]++; } long long sums=0;for(int i=1;i<=9;i++){sums+=cnt1[i];} cnt1[0]=1LL*(H-2)*(W-2)-sums; for(int i=0;i<=9;i++)cout<<cnt1[i]<<endl; return 0; }
a.cc: In function 'void valid(int, int)': a.cc:7:67: error: return-statement with a value, in function returning 'void' [-fpermissive] 7 | void valid(int x,int y){if(x<0 || x>=H-2 || y<0 || y>=W-2){return false;}return true;} | ^~~~~ a.cc:7:81: error: return-statement with a value, in function returning 'void' [-fpermissive] 7 | void valid(int x,int y){if(x<0 || x>=H-2 || y<0 || y>=W-2){return false;}return true;} | ^~~~ a.cc: In function 'int main()': a.cc:12:94: error: expected ')' before ';' token 12 | for(int j=-2;j<=2;j++){for(int k=-2;k<=2;k++)vec.push_back(make_pair(a+j,b+k);)} | ~ ^ | ) a.cc:12:95: error: expected primary-expression before ')' token 12 | for(int j=-2;j<=2;j++){for(int k=-2;k<=2;k++)vec.push_back(make_pair(a+j,b+k);)} | ^ a.cc:15:45: error: invalid operands of types 'void' and 'bool' to binary 'operator==' 15 | if(valid(vec[0].first,vec[0].second)==true)vec2.push_back(vec[0]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ a.cc:18:61: error: invalid operands of types 'void' and 'bool' to binary 'operator==' 18 | if(valid(vec[i].first,vec[i].second)==true)vec2.push_back(vec[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
s515917087
p04000
C++
#include "bits/stdc++.h" using namespace std; #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(a) (a).begin(),(a).end() #define dump(o) if(DEBUG){cerr<<#o<<" "<<o<<endl;} #define dumpc(o) if(DEBUG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;} using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; static const int MOD = 1e9 + 7; static const bool DEBUG = false; signed main() { for (int H, W, N; cin >> H >> W >> N;) { vector<pii> a;//塗りつぶされた vector<pii> b;//中心 rep(i, 0, N) { int y, x; cin >> y >> x; --y, --x; a.emplace_back(y, x); rep(dy, -1, 1) rep(dx, -1, 1) { int yy = y + dy, xx = x + dx; if (1 <= yy && yy <= H - 2 && 1 <= xx && xx <= W - 2) b.emplace_back(yy, xx); } } sort(all(a)); sort(all(b)); b.erase(unique(all(b), b.end())); int ans[10] = {}; for (auto p : b) { int j = 0; rep(dy, -1, 1) rep(dx, -1, 1) { pii q{ p.first + dy, p.second + dx }; j += binary_search(all(a), q); } ++ans[j]; } ans[0] += (H - 2) * (W - 2) - b.size(); rep(i, 0, 10) cout << ans[i] << endl;; } return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >; _Compare = __gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >]': /usr/include/c++/14/bits/stl_algo.h:869:20: required from '_ForwardIterator std::__unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _BinaryPredicate = __gnu_cxx::__ops::_Iter_comp_iter<__gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > > >]' 869 | if (!__binary_pred(__dest, __first)) | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:933:27: required from '_FIter std::unique(_FIter, _FIter, _BinaryPredicate) [with _FIter = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >; _BinaryPredicate = __gnu_cxx::__normal_iterator<pair<long long int, long long int>*, vector<pair<long long int, long long int> > >]' 933 | return std::__unique(__first, __last, | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 934 | __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:17: required from here 30 | b.erase(unique(all(b), b.end())); | ~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:30: error: no match for call to '(__gnu_cxx::__normal_iterator<std::pair<long long int, long long int>*, std::vector<std::pair<long long int, long long int> > >) (std::pair<long long int, long long int>&, std::pair<long long int, long long int>&)' 158 | { return bool(_M_comp(*__it1, *__it2)); } | ~~~~~~~^~~~~~~~~~~~~~~~
s992726470
p04000
C
#include<stdio.h> #include<stdlib.h> #define MALLOC(type, n) (type *)malloc((n)*sizeof(type)) #define HASH(A, W, B) (((W%166667)*(A%166667)+B%166667)%166667) #define TYPELIST unsigned long struct list{ TYPELIST item; struct list *next; }; typedef struct list List; void KillList(List *list){ if(list!=NULL){ KillList(list->next); free(list); } } List* AddList(List *head, TYPELIST item){ List *newlist; newlist=MALLOC(List, 1); newlist->item=item; newlist->next=head; return newlist; } int main(){ unsigned long H, W, N, i, *a, *b, sl[2][2], h, w, k, ax, bx; unsigned long long ans[10] List *table[166667], *lp; int j, finded; for(i=0; i<166667; i++) table[i]=NULL; for(j=0; j<10; j++) ans[j]=0; scanf("%lu %lu %lu", &H, &W, &N); a = MALLOC(unsigned long, N); b = MALLOC(unsigned long, N); for(i=0; i<N; i++){ scanf("%lu %lu", a+i, b+i); table[HASH(a[i], W, b[i])]=AddList(table[HASH(a[i], W, b[i])], i); } for(i=0; i<N; i++){ sl[0][0]=(a[i]<3? 1: a[i]-2); sl[0][1]=(b[i]<3? 1: b[i]-2); sl[1][0]=(H-a[i]<2? H-2: a[i]); sl[1][1]=(W-b[i]<2? W-2: b[i]); for(h=sl[0][0]; h<=sl[1][0]; h++){ for(w=sl[0][1]; w<=sl[1][1]; w++){ j=0; for(k=0; k<9; k++){ ax=h+k/3; bx=w+k%3; lp=table[HASH(ax, W, bx)]; while(lp!=NULL && !(ax==a[lp->item] && bx==b[lp->item])) lp=lp->next; if(lp!=NULL) finded=1; else finded=0; if(finded==1 && lp->item<i){ j=0; break; } else if(finded==1) j++; } ans[j]++; } } } ans[0]=(unsigned long long)(H-2)*(unsigned long long)(W-2); for(j=1; j<10; j++) ans[0] -= ans[j]; for(j=0; j<10; j++) printf("%lu\n", ans[j]); free(a); free(b); for(i=0; i<166667; i++) KillList(table[i]); return 0; }
main.c: In function 'main': main.c:32:35: error: expected ';' before 'List' 32 | unsigned long long ans[10] | ^ | ; 33 | List *table[166667], *lp; | ~~~~ main.c:36:29: error: 'ans' undeclared (first use in this function); did you mean 'abs'? 36 | for(j=0; j<10; j++) ans[j]=0; | ^~~ | abs main.c:36:29: note: each undeclared identifier is reported only once for each function it appears in
s187823231
p04000
Java
import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class Main { static long h, w; static int n; static int[] a, b; public static void main(String[] args){ FastScanner sc = new FastScanner(); h = sc.nextInt(); w = sc.nextInt(); n = sc.nextInt(); a = new int[n]; b = new int[n]; for(int i = 0; i < n; i++){ a[i] = sc.nextInt() - 1; b[i] = sc.nextInt() - 1; } Set< Pair > set = new TreeSet< Pair >(); for(int i = 0; i < n; i++){ set.add(new Pair(b[i], a[i])); } long[] counts = new long[10]; int[] dxc = new int[]{0, -1, -1, -1, 0, 1, 1, 1}; int[] dyc = new int[]{-1, -1, 0, 1, 1, 1, 0, -1}; int[] dxlr = new int[]{1, 2, 0, 1, 2, 0, 1, 2}; int[] dylr = new int[]{0, 0, 1, 1, 1, 2, 2, 2}; int[] dxll = new int[]{1, 2, 0, 1, 2, 0, 1, 2}; int[] dyll = new int[]{0, 0, -1, -1, -1, 1, 1, 1}; int[] dxuu = new int[]{-1, 1, -1, 0, 1, -1, 0 ,1}; int[] dyuu = new int[]{0, 0, -1, -1, -1, -2, -2, -2}; int[] dxll2 = new int[]{1, 2, 0, 1, 2, 0, 1, 2}; int[] dyll2 = new int[]{0, 0, -1, -1, -1, -2, -2, -2}; for(Pair p : set){ boolean flag = true; int count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + dxc[i], ny = p.t + dyc[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ System.out.println("c"); System.out.println(count); System.out.println("x,y" + p.s + " " + p.t); ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + dxlr[i], ny = p.t + dylr[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + -dxlr[i], ny = p.t + -dylr[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + dxll[i], ny = p.t + dyll[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + -dxll[i], ny = p.t + dyll[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + dxuu[i], ny = p.t + dyuu[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + dxuu[i], ny = p.t + -dyuu[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + dxll2[i], ny = p.t + dyll2[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } flag = true; count = 1; for(int i = 0; i < 8; i++){ int nx = p.s + -dxll2[i], ny = p.t + -dyll2[i]; if(!check(nx, ny)){ flag = false; break; } if(set.contains(new Pair(nx, ny))){ ++count; } } if(flag){ ++counts[count]; } } /* for(int i = 0; i < 10; i++){ System.out.println(counts[i]); } */ long sum = 0; for(int i = 1; i < 10; i++){ counts[i] /= i; sum += counts[i]; } counts[0] = (w - 2) * (h - 2) - sum; for(int i = 0; i < 10; i++){ System.out.println(counts[i]); } } static boolean check(int x, int y){ return 0 <= x && x < w && 0 <= y && y < h; } static class Pair implements Comparable< Pair > { int s, t; Pair(int s, int t){ this.s = s; this.t = t; } @Override public int compareTo(Pair p){ if(s == p.s){ return t - p.t; } return s - p.s; } @Override public boolean equals(Object obj){ if(!(obj instanceof Pair)){ return false; } Pair p = (Pair)obj; return s == p.s && t == p.t; } @Override public int hashCode(){ return 13 ^ s ^ t; } } }
Main.java:11: error: cannot find symbol FastScanner sc = new FastScanner(); ^ symbol: class FastScanner location: class Main Main.java:11: error: cannot find symbol FastScanner sc = new FastScanner(); ^ symbol: class FastScanner location: class Main 2 errors
s188932632
p04000
C++
#include <iostream> #include <iomanip> #include <string> #include <vector> #include <queue> #include <algorithm> #include <utility> #include <cmath> #include <bitset> #include <map> #define INF_LL 9000000000000000000 #define INF 2000000000 #define REP(i, n) for(int i = 0;i < (n);i++) #define FOR(i, a, b) for(int i = (a);i < (b);i++) using namespace std; typedef long long ll; typedef pair<int, int> PII; class Union_find{ private: vector<int> par; vector<int> rank; int n; public: Union_find(int a){ n = a; for(int i = 0;i < n;i++){ par.push_back(i); rank.push_back(0); } } int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } } void unite(int x, int y){ x = find(x); y = find(y); if(x == y) return; if(rank[x] < rank[y]){ par[x] = y; }else{ par[y] = x; if(rank[x] == rank[y]) rank[x]++; } } bool same(int x, int y){ return find(x) == find(y); } }; int main(){ int h,w,n; cin>>h>>w>>n; map<pair<int,int>,int> cnt; while(n--){ int a,b; cin>>a>>b; a--; b--; for(int i==0;i<3;i++){ for(int j=0;j<3;j++){ if(a+i>=0&&b+j>=0){ cnt[make_pair(a+i,b+j)]++; } } } } long long ans[10] = {(long long)(h-2)*(w-2)}; for(auto& elem : cnt){ ans[0]--; ans[elem.second]++; } for(int i=0;i<10;i++){ cout<<ans[i]<<endl; } return 0; } }
a.cc: In function 'int main()': a.cc:73:14: error: expected ';' before '==' token 73 | for(int i==0;i<3;i++){ | ^~ | ; a.cc:73:14: error: expected primary-expression before '==' token 73 | for(int i==0;i<3;i++){ | ^~ a.cc:73:21: error: expected ')' before ';' token 73 | for(int i==0;i<3;i++){ | ~ ^ | ) a.cc:73:22: error: 'i' was not declared in this scope 73 | for(int i==0;i<3;i++){ | ^ a.cc: At global scope: a.cc:92:1: error: expected declaration before '}' token 92 | } | ^
s930564871
p04000
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) #define int long long typedef long long ll; using namespace std; int H, W, N; int a, b; set<pair<int, int> > kuro; ll dp[10]; signed main() { cin >> H >> W >> N; rep(i,10) dp[i] = 0; dp[0] = (H - 2) * (W - 2); rep(i,N) { cin >> a >> b; for (int x=max(1, b-2); x<=b; x++) { if (!(b+2 <= W)) continue; for (int y=max(1, a-2); y<=a; y++) { if (!(a+2 <= H)) continue; int kuro_num = 0; rep(xx,3) rep(yy,3) { if (kuro.find(make_pair(a + xx, b + yy)) != kuro.end()) { kuro_num++; } } dp[kuro_num-1]--; dp[kuro_num]++; } } kuro.insert(make_pair(a, b)); } rep(i,10) cout << dp[i] << endl; }
a.cc: In function 'int main()': a.cc:20:31: error: no matching function for call to 'max(int, long long int)' 20 | for (int x=max(1, b-2); x<=b; x++) { | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:20:31: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 20 | for (int x=max(1, b-2); x<=b; x++) { | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:20:31: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | for (int x=max(1, b-2); x<=b; x++) { | ~~~^~~~~~~~ a.cc:22:39: error: no matching function for call to 'max(int, long long int)' 22 | for (int y=max(1, a-2); y<=a; y++) { | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:22:39: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 22 | for (int y=max(1, a-2); y<=a; y++) { | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:39: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | for (int y=max(1, a-2); y<=a; y++) { | ~~~^~~~~~~~
s938522547
p04000
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) //#define int long long typedef long long ll; using namespace std; int H, W, N; int a, b; set<pair<int, int> > kuro; ll dp[10]; signed main() { cin >> H >> W >> N; rep(i,10) dp[i] = 0; dp[0] = (H - 2) * (W - 2); rep(i,N) { cin >> a >> b; for (int x=max(1, b-2); x<=b; x++) { if (!(b+2 <= W)) continue; for (int y=max(1, a-2); y<=a; y++) { if (!(a+2 <= H)) continue; int kuro_num = 0; rep(xx,3) rep(yy,3) { if (kuro.find(make_pair(a + xx, b + yy)) != kuro.end()) { kuro_num++; } } dp[kuro_num-1]--; dp[kuro_num]++; } } set.insert(make_pair(a, b)); } rep(i,10) cout << dp[i] << endl; }
a.cc: In function 'int main()': a.cc:34:20: error: expected unqualified-id before '.' token 34 | set.insert(make_pair(a, b)); | ^
s642716255
p04001
C++
#include<bits/stdc++.h> using namespace std; main(){ long long X; cin >> X; int N=log10(X)+1; int M=pow(2,N-1); int S=0; for (int i=0;i<M;i++){ int A=X; int SUM=0; int L=0; int j=i; for (int i2=0;i2<N;i2++){ int L=L+1; if (j%2==1){ SUM=SUM+A%pow(10,L); A=A/10; L=0; } j=i/2 } SUM=SUM+A; S=S+SUM; } cout << S << endl; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:18:26: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 18 | SUM=SUM+A%pow(10,L); | ~^~~~~~~~~~ | | | | int __gnu_cxx::__promote<double>::__type {aka double} a.cc:22:18: error: expected ';' before '}' token 22 | j=i/2 | ^ | ; 23 | } | ~
s118106993
p04001
C++
#include<bits/stdc++.h> using namespace std; main(){ long long X; cin >> X; int N=log10(X)+1; int M=pow(2,N-1); int S=0; for (int i=0;i<M;i++){ int A=X; int SUM=0; int L=0; j=i; for (int i2=0;i2<N;i2++){ L=L+1; if (j%2==1){ SUM=SUM+A%pow(10,L); A=A/10; L=0; } j=i/2 } SUM=SUM+A; S=S+SUM; } cout << S << endl; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:14:9: error: 'j' was not declared in this scope 14 | j=i; | ^ a.cc:18:26: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 18 | SUM=SUM+A%pow(10,L); | ~^~~~~~~~~~ | | | | int __gnu_cxx::__promote<double>::__type {aka double}
s344234935
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { int length,sum = 0,num = 0; string S,T = ""; cin >> S; length = S.size()-1; for(int mask = 0;mask < (1<<length)); mask++){ for(int i=0;i<length;i++){ if(mask & (1<<i)){ for(int j = num;j <= i; j++)T += S.at(j); num += stoi(T); T = ""; } } } return 0; }
a.cc: In function 'int main()': a.cc:11:39: error: expected ';' before ')' token 11 | for(int mask = 0;mask < (1<<length)); mask++){ | ^ | ; a.cc:11:42: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'? 11 | for(int mask = 0;mask < (1<<length)); mask++){ | ^~~~ | std::filesystem::perms::mask In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200, from a.cc:1: /usr/include/c++/14/bits/fs_fwd.h:162:7: note: 'std::filesystem::perms::mask' declared here 162 | mask = 07777, | ^~~~
s171331308
p04001
C++
#include <bits/stdc++.h> using namespace std; int main () { string S; cin >> S; const int num = S.size() - 1; int64_t ans = 0; for (int tmp = 0; tmp < (1 << num); tmp++) { bitset<num> b(tmp); int sum = 0; string T = ""; for (int i = 0; i < num; i++) { if(b.test(0)){ sum += stoi(T); T = ""; }else{ T += S.at(i); } b >>; ans += sum; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:15: error: the value of 'num' is not usable in a constant expression 12 | bitset<num> b(tmp); | ^ a.cc:7:13: note: 'num' was not initialized with a constant expression 7 | const int num = S.size() - 1; | ^~~ a.cc:12:15: note: in template argument for type 'long unsigned int' 12 | bitset<num> b(tmp); | ^ a.cc:17:12: error: request for member 'test' in 'b', which is of non-class type 'int' 17 | if(b.test(0)){ | ^~~~ a.cc:23:11: error: expected primary-expression before ';' token 23 | b >>; | ^
s618179094
p04001
C
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i ++) int main(){ string s; cin >> s; int sz = s.size(); ll all_pat = pow(2, sz - 1); ll ans = 0; reverse(s.begin(), s.end()); rep(pat, all_pat){ ll d = 1; for(int i = 0; i < sz - 1; i ++){ ans += (s.at(i) - '0') * d; if((pat >> i) & 1) d = 1; else d *= 10; } ans += (s.at(sz - 1) - '0') * d; } cout << ans << endl; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s042672511
p04001
C
#include <iostream> #include <vector> #include <string> using namespace std; int main() { int n; string str; string copy; cin >> str; copy = str; n = str.length() - 1;//+を入れることができる場所の数 long long total = 0LL; for (int bit = 0; bit < (1 << n); ++bit) { vector<int> S; for (int i = 0; i < n; ++i) { if (bit & (1 << i)) { S.push_back(i+1); } } for (int i = (int)S.size()-1; i>=0; --i) { if (i == (int)S.size() - 1) total += stoll(str.substr(S[i])); else total += stoll(str.substr(S[i], S[i+1]-S[i])); if (i == 0) { total += stoll(str.erase(S[i])); str = copy; } } if ((int)S.size() == 0) total += stoll(str); } cout << total ; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s734221855
p04001
C++
#include <iostream> #include <bitset> using namespace std; int main() { string str; cin >> str; long long ans = 0, tmp; for (int i = 0;i < pow(2,str.size()-1);i++) { bitset<9> s(i); tmp = str[0] - '0'; for (int j = 0;j < str.size()-1;j++) { if (s.test(j)) { ans += tmp; tmp = str[j + 1] - '0'; } else { tmp *= 10; tmp += str[j + 1] - '0'; } } ans += tmp; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:28: error: 'pow' was not declared in this scope 9 | for (int i = 0;i < pow(2,str.size()-1);i++) { | ^~~
s280266444
p04001
C++
#include <iostream> #include <vector> #include <map> #include <string> #include <algorithm> #include <cmath> #define intt long long int main() { std::string S; std::cin >> S; int N = S.size() - 1; int ans = 0; for (int bit = 0; bit < (1 << N); ++bit) { int total = 0; for (int i = 0; i < N; ++i) { total *= 10; total += S[i] - '0'; if (bit & (1 << i)) { ans += total; total = 0; } } total *= 10; total += S[N - 1] - '0'; ans += total; } std:::cout << ans << std::endl; }
a.cc: In function 'int main()': a.cc:27:14: error: expected unqualified-id before ':' token 27 | std:::cout << ans << std::endl; | ^
s985443386
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int size = S.size(); long sum = 0; for (int i = 0; i < size; i++){ for (int j = i + 1; j <= size; j++){ long target = atoi(S.substr(i, j - i).c_str()); int insert_space = 0; if (i > 1) insert_space += i - 1; if (size - j > 1) insert_space += size - j - 1; sum += target * pow(2, insert_space); } }
a.cc: In function 'int main()': a.cc:18:4: error: expected '}' at end of input 18 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s157827125
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); } cout << A << endl; }
a.cc: In function 'int main()': a.cc:11:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>') 11 | cout << A << endl; | ~~~~ ^~ ~ | | | | | std::vector<int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) | ^~~~~~~~~ /
s838593949
p04001
C++
#include <iostream> #include <string> using namespace std; long add(const string& numbers, const int& bitsOfPlusPosition); int main() { string numbers; cin >> numbers; long answer = 0; for (int bits = 0; bits < (1 << (numbers.size() - 1)); ++bits) { answer += add(numbers, bits); } cout << answer << endl; } long add(const string& numbers, const int bitsOfPlusPosition) { const int DECIMAL_BASE = 10; long sum = 0; long term = 0; for (size_t i = 0U; i < numbers.size(); ++i) { term *= DECIMAL_BASE; term += numbers.at(i) - '0'; if (bitsOfPlusPosition & (1 << i) || i == numbers.size() - 1) { sum += term; term = 0; } } return sum; }
/usr/bin/ld: /tmp/cct5qwac.o: in function `main': a.cc:(.text+0x4b): undefined reference to `add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int const&)' collect2: error: ld returned 1 exit status
s992629836
p04001
C++
#include <iostream> #include <string> using namespace std; long add(const string& numbers, const int& bitsOfPlusPosition); int main() { string numbers; cin >> numbers; long answer = 0; for (int bits = 0; bits < (1 << (numbers.size() - 1)); ++bits) { answer += add(numbers, bits); } cout << answer << endl; } long add(const string& numbers, const int& bitsOfPlusPosition) { const int DICIMAL_BASE = 10; long sum = 0; long term = 0; for (size_t i = 0U; i < numbers.size(); ++i) { term *= DECIMAL_BASE; term += numbers.at(i) - '0'; if (bitsOfPlusPosition & (1 << i) || i == numbers.size() - 1) { sum += term; term = 0; } } return sum; }
a.cc: In function 'long int add(const std::string&, const int&)': a.cc:24:17: error: 'DECIMAL_BASE' was not declared in this scope; did you mean 'DICIMAL_BASE'? 24 | term *= DECIMAL_BASE; | ^~~~~~~~~~~~ | DICIMAL_BASE
s370870162
p04001
C++
#include<bits/stdc++.h> using namespace std; char s[15]; long long cof[15],n,data[15],pow_10[10],cnt,cou=0; void gen(long long lv) { if(lv==n-1) { data[n-1]=1; /*for(int i=0;i<n-1;i++) { printf("%lld ",data[i]); } printf("\n");*/ cnt=0; for(int i=n-1;i>=0;i--) { if(data[i]==1) { cnt=0; }else { ++cnt; } cof[i]=cnt; } /*for(int i=0;i<n;i++) { printf("%lld ",cof[i]); } printf("\n");*/ for(int i=0;i<n;i++) { cou+=(pow_10[cof[i]]*(s[i]-48)); } return; } for(int i=0;i<=1;i++) { data[lv]=i; gen(lv+1); } } int main() { pow_10[0]=1; for(int i=1;i<=10;i++) { pow_10[i]=pow_10[i-1]*10; } scanf("%s",s); n=strlen(s); gen(0); printf("%lld\n",cou); }
a.cc: In function 'void gen(long long int)': a.cc:9:17: error: reference to 'data' is ambiguous 9 | data[n-1]=1; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:21: note: 'long long int data [15]' 4 | long long cof[15],n,data[15],pow_10[10],cnt,cou=0; | ^~~~ a.cc:18:28: error: reference to 'data' is ambiguous 18 | if(data[i]==1) | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:21: note: 'long long int data [15]' 4 | long long cof[15],n,data[15],pow_10[10],cnt,cou=0; | ^~~~ a.cc:40:17: error: reference to 'data' is ambiguous 40 | data[lv]=i; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:21: note: 'long long int data [15]' 4 | long long cof[15],n,data[15],pow_10[10],cnt,cou=0; | ^~~~
s265490453
p04001
C++
#include<bits/stdc++.h> using namespace std; char s[15]; long long cof[15],n,data[15],pow_10[10],cnt,cou=0; void gen(long long lv) { if(lv==n-1) { data[n-1]=1; /*for(int i=0;i<n-1;i++) { printf("%lld ",data[i]); } printf("\n");*/ cnt=0; for(int i=n-1;i>=0;i--) { if(data[i]==1) { cnt=0; }else { ++cnt; } cof[i]=cnt; } /*for(int i=0;i<n;i++) { printf("%lld ",cof[i]); } printf("\n");*/ for(int i=0;i<n;i++) { cou+=(pow_10[cof[i]]*(s[i]-48)); } return; } for(int i=0;i<=1;i++) { data[lv]=i; gen(lv+1); } } int main() { pow_10[0]=1; for(int i=1;i<=10;i++) { pow_10[i]=pow_10[i-1]*10; } scanf("%s",s); n=strlen(s); gen(0); printf("%lld\n",cou); }
a.cc: In function 'void gen(long long int)': a.cc:9:17: error: reference to 'data' is ambiguous 9 | data[n-1]=1; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:21: note: 'long long int data [15]' 4 | long long cof[15],n,data[15],pow_10[10],cnt,cou=0; | ^~~~ a.cc:18:28: error: reference to 'data' is ambiguous 18 | if(data[i]==1) | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:21: note: 'long long int data [15]' 4 | long long cof[15],n,data[15],pow_10[10],cnt,cou=0; | ^~~~ a.cc:40:17: error: reference to 'data' is ambiguous 40 | data[lv]=i; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:4:21: note: 'long long int data [15]' 4 | long long cof[15],n,data[15],pow_10[10],cnt,cou=0; | ^~~~
s594036666
p04001
C++
#include <bits/stdc++.h> /* 本当は個別にヘッダファイルを読みだすべき #include <iostream> // cout, endl, cin #include <string> // string, to_string, stoi #include <vector> // vector #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <utility> // pair, make_pair #include <tuple> // tuple, make_tuple #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <map> // map #include <queue> // queue, priority_queue #include <set> // set #include <stack> // stack #include <deque> // deque #include <unordered_map> // unordered_map #include <unordered_set> // unordered_set #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower */ using namespace std; #define rep(i,a,n) for(int i=a,i<n,i++) #define vvi vector<vector<int>> #define vi vector<int> #define pi pair<int,int> #define ti tuple<int,int,int> #define gi get<i> //get<i>(data) int ctoi(char c){ if(c >= '0' && c <= '9'){ return c-'0'; } return 0; } long long answer = 0; int dfs(string s, int i, long long presum, long long sum){ if(i == s.size() -1){//最後の文字まで到達 sum += presum + ctoi(s.at(i)); answer += sum;//答えに足して終了させる return 0; }else{ presum += ctoi(s.at(i)); dfs(s,i+1,presum*10,sum); sum += presum; dfs(s,i+1,0,sum); return 0; } } int main(){ string S; cin >> S; dfs(s,0,0,0); cout << answer << endl; return 0; }
a.cc: In function 'int main()': a.cc:59:9: error: 's' was not declared in this scope 59 | dfs(s,0,0,0); | ^
s703986595
p04001
C++
#include <iostream> #include <string> using namespace std; int main(){ string a; int sum=0; cin >> a; for(int i=1;i<=a.size()-1;i++){ a.insert(a[i],"+"); sum+=a; } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:8: error: no match for 'operator+=' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 10 | sum+=a; | ~~~^~~
s251118536
p04001
C++
#include <iostream> #include <string> using namespace std; int main(){ str a; int sum=0; cin >> a; for(int i=1;i<=a.size()-1;i++){ a.insert(a[i],"+"); sum+=a; } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:3: error: 'str' was not declared in this scope; did you mean 'std'? 5 | str a; | ^~~ | std a.cc:7:10: error: 'a' was not declared in this scope 7 | cin >> a; | ^
s442442672
p04001
C++
#include<bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; int sum=0, size, flag=0; size = S.size(); vector<int> A(size); for(int i=0;i<size;i++){ A.at(i) = (S.at(i) - '0'); } for(int tmp=0;tmp < (1 << 9);tmp++){ bitset(10) p(tmp); p.set(9); for(int i=0;i<size;i++){ if(p.test(i)){ while(flag > 0){ sum += A.at(i-flag) * pow(10,flag); flag--; } sum += A.at(i); }else{ flag++; } } cout << sum << endl; } }
a.cc: In function 'int main()': a.cc:16:14: error: class template argument deduction failed: 16 | bitset(10) p(tmp); | ^ a.cc:16:14: error: no matching function for call to 'bitset(int)' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bitset:1020:9: note: candidate: 'template<long unsigned int _Nb, class _CharT> bitset(const _CharT*, typename std::__bitset::__string<_CharT>::size_type, _CharT, _CharT)-> std::bitset<_Nb>' 1020 | bitset(const _CharT* __str, | ^~~~~~ /usr/include/c++/14/bitset:1020:9: note: template argument deduction/substitution failed: a.cc:16:14: note: mismatched types 'const _CharT*' and 'int' 16 | bitset(10) p(tmp); | ^ /usr/include/c++/14/bitset:996:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::size_t, std::size_t, _CharT, _CharT)-> std::bitset<_Nb>' 996 | bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, | ^~~~~~ /usr/include/c++/14/bitset:996:9: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bitset:984:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::size_t, std::size_t)-> std::bitset<_Nb>' 984 | bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, | ^~~~~~ /usr/include/c++/14/bitset:984:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bitset:962:9: note: candidate: 'template<long unsigned int _Nb, class _CharT, class _Traits, class _Alloc> bitset(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::size_t)-> std::bitset<_Nb>' 962 | bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, | ^~~~~~ /usr/include/c++/14/bitset:962:9: note: template argument deduction/substitution failed: a.cc:16:14: note: mismatched types 'const std::__cxx11::basic_string<_Ch_type, _St, _Sa>' and 'int' 16 | bitset(10) p(tmp); | ^ /usr/include/c++/14/bitset:941:17: note: candidate: 'template<long unsigned int _Nb> bitset(long long unsigned int)-> std::bitset<_Nb>' 941 | constexpr bitset(unsigned long long __val) noexcept | ^~~~~~ /usr/include/c++/14/bitset:941:17: note: template argument deduction/substitution failed: a.cc:16:14: note: couldn't deduce template parameter '_Nb' 16 | bitset(10) p(tmp); | ^ /usr/include/c++/14/bitset:936:26: note: candidate: 'template<long unsigned int _Nb> bitset()-> std::bitset<_Nb>' 936 | _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bitset:936:26: note: candidate expects 0 arguments, 1 provided /usr/include/c++/14/bitset:804:11: note: candidate: 'template<long unsigned int _Nb> bitset(std::bitset<_Nb>)-> std::bitset<_Nb>' 804 | class bitset | ^~~~~~ /usr/include/c++/14/bitset:804:11: note: template argument deduction/substitution failed: a.cc:16:14: note: mismatched types 'std::bitset<_Nb>' and 'int' 16 | bitset(10) p(tmp); | ^ a.cc:17:5: error: 'p' was not declared in this scope 17 | p.set(9); | ^
s919980626
p04001
C
#include<bits/stdc++.h> using namespace std; int a[15]; int num=1,len; long long ans=0; string s; int main() { cin>>s; len=s.size(); for(int i=0;i<len;i++) a[i+1]=(s[i]-'0'); for(int i=1;i<len;i++) num*=2; for(int i=0;i<num;i++) { bool b[15]={0}; int tmp=i; int k=1; while(tmp) b[k++]=tmp%2,tmp/=2; long long cn=0; for(int j=1;j<=len;j++) { cn=cn*10+a[j]; if(b[j]) { ans+=cn; cn=0; } } ans+=cn; } cout<<ans; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s948246660
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,M=0,sum=0,X=1; cin>>N; int n=N; while(!(n/10==0)){ sum++; n /=10 } int c=pow(2, sum); for(int tmp=0;tmp<c;tmp++){ bitset<9> A(tmp); int s=N; int t=1; for(int i=0;i<sum;i++){ if(A.test(i)){ int a=pow(10, t); M +=s%a; s /=a; t =1; } else t++; } M +=s; } cout<<M<<endl; }
a.cc: In function 'int main()': a.cc:10:11: error: expected ';' before '}' token 10 | n /=10 | ^ | ; 11 | } | ~
s245426272
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,M=0,sum=0,X=1; cin>>N; int n=N while(!(n/10==0)){ sum++; n /=10 } int c=pow(2, sum); for(int tmp=0;tmp<c;tmp++){ bitset<9> A(tmp); int s=N; int t=1; for(int i=0;i<sum;i++){ if(A.test(i)){ int a=pow(10, t); M +=s%a; s /=a; t =1; } else t++; } M +=s; } cout<<M<<endl; }
a.cc: In function 'int main()': a.cc:8:3: error: expected ',' or ';' before 'while' 8 | while(!(n/10==0)){ | ^~~~~
s093211766
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,M=0,sum=0,X=1; cin>>N; while(!(N/10==0)){ sum++; } for(int tmp=0;tmp<pow(2, sum);tmp++){ bitset<9> A(tmp); int s=N; int t=1; for(int i=0;i<sum;i++){ if(A.test(i)){ M +=s%pow(10, t); s /=pow(10, t); t =1; } else t++; } M +=s; } cout<<M<<endl; }
a.cc: In function 'int main()': a.cc:16:14: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 16 | M +=s%pow(10, t); | ~^~~~~~~~~~~ | | | | int __gnu_cxx::__promote<double>::__type {aka double}
s289864348
p04001
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,M=0,sum=0,X=1; cin>>N; while(!(N/10==0)){ sum++; } for(int tmp=0;tmp<pow(2, sum);tmp++){ bitset<9> A(tmp) int s=N; int t=1; for(int i=0;i<sum;i++){ if(A.test(i)){ M +=s%pow(10, t); s /=pow(10, t); t =1; } else t++; } M +=s; } cout<<M<<endl; }
a.cc: In function 'int main()': a.cc:12:5: error: expected ',' or ';' before 'int' 12 | int s=N; | ^~~ a.cc:16:13: error: 's' was not declared in this scope 16 | M +=s%pow(10, t); | ^ a.cc:22:9: error: 's' was not declared in this scope 22 | M +=s; | ^
s017631580
p04001
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 inf 1001001001001001001 #define mod 1000000007 #define mod2 998244353 #define pi acos(-1) #define all(v) v.begin(),v.end() int main(){ string s; cin>>s; int sum=0; for(int i=0;i<s.size();i++){ int a,b; string str=""; char c; for(ll l=0;l<i;l++){ c=s.at(l); str+=c; } a=stoi(str); string str=""; for(ll l=i;l<s.size();l++){ c=s.at(l); str+=c; } b=stoi(str); sum+=(a+b); } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:24:16: error: redeclaration of 'std::string str' 24 | string str=""; | ^~~ a.cc:17:16: note: 'std::string str' previously declared here 17 | string str=""; | ^~~
s698010221
p04001
C++
#include "bits/stdc++.h" #define REP(i,n) for(int i=0;i< (n);i++) #define REPR(i, n) for(int i = (n);i >= 0;i--) #define FOR(i, m, n) for(int i = (m);i < (n);i++) #define FORR(i, m, n) for(int i = (m);i >= (n);i--) #define SORT(v, n) std::sort(v, v+n); #define VSORT(v) std::sort(v.begin(), v.end()); #define VRSORT(v) std::sort(v.rbegin(), v.rend()); #define ll long long #define pb(a) push_back(a) #define ALL(obj) (obj).begin(),(obj).end() using namespace std; const int INF = 99999999; const ll LINF = 9999999999999; typedef pair<ll, ll> LP; int dx[4] = { 1,0,-1,0 }; int dy[4] = { 0,1,0,-1 }; string S; ll dfs(ll index,ll times,ll num) { ll add = ll(S[index] - '0') * times; if (index + 1 == ll(S.size())) {return num + add; } return dfs(index + 1, times * 10,num+ add) + dfs(index + 1, 1, num + add); } int main() { cin >> S; reverse(ALL(S)); cout << dfs(0, 1,0)<<endl; return 0; }
a.cc: In function 'long long int dfs(long long int, long long int, long long int)': a.cc:10:12: error: expected primary-expression before 'long' 10 | #define ll long long | ^~~~ a.cc:27:18: note: in expansion of macro 'll' 27 | ll add = ll(S[index] - '0') * times; | ^~ a.cc:10:12: error: expected primary-expression before 'long' 10 | #define ll long long | ^~~~ a.cc:28:26: note: in expansion of macro 'll' 28 | if (index + 1 == ll(S.size())) {return num + add; } | ^~ a.cc:28:25: error: expected ')' before 'long' 28 | if (index + 1 == ll(S.size())) {return num + add; } | ~ ^ | )
s244534310
p04001
C++
#include "bits/stdc++.h" #define REP(i,n) for(int i=0;i< (n);i++) #define REPR(i, n) for(int i = (n);i >= 0;i--) #define FOR(i, m, n) for(int i = (m);i < (n);i++) #define FORR(i, m, n) for(int i = (m);i >= (n);i--) #define SORT(v, n) std::sort(v, v+n); #define VSORT(v) std::sort(v.begin(), v.end()); #define VRSORT(v) std::sort(v.rbegin(), v.rend()); #define ll long long #define pb(a) push_back(a) #define ALL(obj) (obj).begin(),(obj).end() using namespace std; const int INF = 99999999; const ll LINF = 9999999999999; typedef pair<ll, ll> LP; int dx[4] = { 1,0,-1,0 }; int dy[4] = { 0,1,0,-1 }; string S; ll dfs(ll index,ll times,ll num) { ll add = long long(S[index]- long long('0')) * times; if (index + 1 == ll(S.size())) {return num + add; } return dfs(index + 1, times * 10,num+ add) + dfs(index + 1, 1, num + add); } int main() { cin >> S; reverse(ALL(S)); cout << dfs(0, 1,0)<<endl; return 0; }
a.cc: In function 'long long int dfs(long long int, long long int, long long int)': a.cc:27:18: error: expected primary-expression before 'long' 27 | ll add = long long(S[index]- long long('0')) * times; | ^~~~ a.cc:10:12: error: expected primary-expression before 'long' 10 | #define ll long long | ^~~~ a.cc:28:26: note: in expansion of macro 'll' 28 | if (index + 1 == ll(S.size())) {return num + add; } | ^~ a.cc:28:25: error: expected ')' before 'long' 28 | if (index + 1 == ll(S.size())) {return num + add; } | ~ ^ | )
s306854194
p04001
C++
#include "bits/stdc++.h" #define REP(i,n) for(int i=0;i< (n);i++) #define REPR(i, n) for(int i = (n);i >= 0;i--) #define FOR(i, m, n) for(int i = (m);i < (n);i++) #define FORR(i, m, n) for(int i = (m);i >= (n);i--) #define SORT(v, n) std::sort(v, v+n); #define VSORT(v) std::sort(v.begin(), v.end()); #define VRSORT(v) std::sort(v.rbegin(), v.rend()); #define ll long long #define pb(a) push_back(a) #define ALL(obj) (obj).begin(),(obj).end() using namespace std; const int INF = 99999999; const ll LINF = 9999999999999; typedef pair<ll, ll> LP; int dx[4] = { 1,0,-1,0 }; int dy[4] = { 0,1,0,-1 }; string S; ll dfs(ll index,ll times,ll num) { ll add = ll(S[index]-ll('0')) * times; if (index + 1 == ll(S.size())) {return num + add; } return dfs(index + 1, times * 10,num+ add) + dfs(index + 1, 1, num + add); } int main() { cin >> S; reverse(ALL(S)); cout << dfs(0, 1,0)<<endl; return 0; }
a.cc: In function 'long long int dfs(long long int, long long int, long long int)': a.cc:10:12: error: expected primary-expression before 'long' 10 | #define ll long long | ^~~~ a.cc:27:18: note: in expansion of macro 'll' 27 | ll add = ll(S[index]-ll('0')) * times; | ^~ a.cc:10:12: error: expected primary-expression before 'long' 10 | #define ll long long | ^~~~ a.cc:28:26: note: in expansion of macro 'll' 28 | if (index + 1 == ll(S.size())) {return num + add; } | ^~ a.cc:28:25: error: expected ')' before 'long' 28 | if (index + 1 == ll(S.size())) {return num + add; } | ~ ^ | )
s460958321
p04001
C++
#include "bits/stdc++.h" #define REP(i,n) for(int i=0;i< (n);i++) #define REPR(i, n) for(int i = (n);i >= 0;i--) #define FOR(i, m, n) for(int i = (m);i < (n);i++) #define FORR(i, m, n) for(int i = (m);i >= (n);i--) #define SORT(v, n) std::sort(v, v+n); #define VSORT(v) std::sort(v.begin(), v.end()); #define VRSORT(v) std::sort(v.rbegin(), v.rend()); #define ll long long #define pb(a) push_back(a) #define ALL(obj) (obj).begin(),(obj).end() using namespace std; const int INF = 99999999; const ll LINF = 9999999999999; typedef pair<ll, ll> LP; int dx[4] = { 1,0,-1,0 }; int dy[4] = { 0,1,0,-1 }; string S; ll dfs(ll index,ll times,ll num) { ll add = ll(S[index]-ll('0')) * times; if (index + 1 == S.size()) {return num + add; } return dfs(index + 1, times * 10,num+ add) + dfs(index + 1, 1, num + add); } int main() { cin >> S; reverse(ALL(S)); cout << dfs(0, 1,0)<<endl; return 0; }
a.cc: In function 'long long int dfs(long long int, long long int, long long int)': a.cc:10:12: error: expected primary-expression before 'long' 10 | #define ll long long | ^~~~ a.cc:27:18: note: in expansion of macro 'll' 27 | ll add = ll(S[index]-ll('0')) * times; | ^~
s578519181
p04001
C++
#include<bits/stdc++.h> using namespace std; long long calc(string s){ int N = s.size(); long long ret = stoll(s); //recursive step for(int i=1;i<N;i++){ string sl = s.substr(0,i); ret += stoll(sl)*pow(2,sr.size()-1); string sr = s.substr(i,N-i); ret += calc(sr); } return ret; } int main(){ string s; cin >> s; cout << calc(s) << endl; }
a.cc: In function 'long long int calc(std::string)': a.cc:11:28: error: 'sr' was not declared in this scope; did you mean 'sl'? 11 | ret += stoll(sl)*pow(2,sr.size()-1); | ^~ | sl
s530370468
p04001
C++
#include <algorithm> #include <cmath> #include <ctype.h> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define ENDL '\n' #define FOR(i, n) for (int i = 0; i < n; i++) #define FOR_EACH(i, v) for (auto&& i : v) long long* memo; long long calc(string& s) { int len = s.length(); if (memo[len - 1]) { return memo[len - 1]; } long long sum = stoll(s); for (int i = 1; i < len; i++) { sum += stoll(s.substr(0, i)) * (long long)pow(2, len - i - 1) + calc(s.substr(i)); } memo[len - 1] = sum; return sum; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; int len = S.length(); memo = new long long[len]; FOR(i, len) { memo[i] = 0LL; } cout << calc(S) << ENDL; delete memo; return 0; }
a.cc: In function 'long long int calc(std::string&)': a.cc:34:94: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>' 34 | sum += stoll(s.substr(0, i)) * (long long)pow(2, len - i - 1) + calc(s.substr(i)); | ~~~~~~~~^~~ a.cc:24:24: note: initializing argument 1 of 'long long int calc(std::string&)' 24 | long long calc(string& s) | ~~~~~~~~^
s174006317
p04001
C++
#include<iostream> #include<string> #include<algorithm> #include<math.h> #include<queue> #include<vector> #include<map> #include<cstdlib> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) string s; int main(){ int ans=0; cin >> s; int n = s.size(); long long int a; rep(i,(1<<(n-1) - 1){ a = 0; rep(j,n-1){ a = a*10 + s[j] - '0'; if((i>>j) & 1){ ans += a; a = 0; } } ans += a; } cout << ans << endl; return 0; }
a.cc:36:2: error: unterminated argument list invoking macro "rep" 36 | } | ^ a.cc: In function 'int main()': a.cc:23:5: error: 'rep' was not declared in this scope 23 | rep(i,(1<<(n-1) - 1){ | ^~~ a.cc:23:8: error: expected '}' at end of input 23 | rep(i,(1<<(n-1) - 1){ | ^ a.cc:18:11: note: to match this '{' 18 | int main(){ | ^
s991665922
p04001
C++
#include <iostream> #include <string> #include <sstream> #include <cmath> int main(int argc, const char * argv[]) { std::string S; std::cin >> S; unsigned long size = S.size(); if(size == 1) { std::cout << S; return; } long long count = std::pow(2, size - 1); long long sum = 0; for(unsigned long i=0; i<count; i++) { std::string formula; formula.push_back(S[0]); for(unsigned long j=0; j<=size-2; j++) { if(i&(1<<j)) { formula.push_back('+'); } std::cout << j <<std::endl; formula.push_back(S[j+1]); } std::istringstream strm(formula); std::string tmp; unsigned long ans = 0; while(getline(strm, tmp, '+')) { ans += std::stoll(tmp); } sum += ans; } std::cout << sum; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:14:9: error: return-statement with no value, in function returning 'int' [-fpermissive] 14 | return; | ^~~~~~
s046955382
p04001
C++
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ char s[11]; scanf("%s",s); int i,j; long long ans=0; long long tmp; // ’+’で分割したものを代入 for(i=0;i<( 1 << ( strlen(s) - 1 ) );i++){ // S="125"なら、i=(00)_2~(11)_2まで。   // strlen(s) にすると、i=(111)_2までになる。 tmp = s[0] - '0'; // Sの1文字目を数値に変換して代入 for(j=0;j<( strlen(s) - 1 );j++){ if( i & ( 1 << j ) ){ // 例:(i,j)=(0,1) ⇒ (00) AND (10) ans += tmp; //     ⇒ (10) ⇒ 12 + 5 tmp = 0; // 分割した分を足して、tmpを初期化 } tmp = tmp*10 + (s[j+1] - '0'); } ans += tmp; // 最後の分割部分を足す。 } printf("%lld",ans); return 0; }
a.cc:14:45: error: extended character   is not valid in an identifier 14 |   // strlen(s) にすると、i=(111)_2までになる。 | ^ a.cc:23:20: error: extended character   is not valid in an identifier 23 | ans += tmp; // 最後の分割部分を足す。 | ^ a.cc: In function 'int main()': a.cc:14:45: error: '\U00003000' was not declared in this scope 14 |   // strlen(s) にすると、i=(111)_2までになる。 | ^~ a.cc:23:22: error: expected ';' before '}' token 23 | ans += tmp; // 最後の分割部分を足す。 | ^ | ; 24 | } | ~
s467350778
p04001
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int sum(int n) { vector<int> on; while(on >= 0) { on.push_back(n % 10); on /= 10; } return all_sum(n, on); } int all_sum(int n; vector<int> on) { } int main() { int n; vector<int> on; cin >> n; while(on >= 0) { on.push_back(n % 10); on /= 10; } }
a.cc: In function 'int sum(int)': a.cc:7:12: error: no match for 'operator>=' (operand types are 'std::vector<int>' and 'int') 7 | while(on >= 0) { | ~~ ^~ ~ | | | | | int | std::vector<int> 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:1165:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1165 | operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1165:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/regex.h:1248: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>&)' 1248 | operator>=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1248:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/regex.h:1341: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>&)' 1341 | operator>=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1341:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/regex.h:1415:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1415 | operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1415:5: note: template argument deduction/substitution failed: a.cc:7:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/regex.h:1509:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1509 | operator>=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1509:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/regex.h:1586:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1586 | operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1586:5: note: template argument deduction/substitution failed: a.cc:7:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/regex.h:1686:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1686 | operator>=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1686:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | while(on >= 0) { | ^ 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:1070:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1070 | operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1070:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>' 7 | while(on >= 0) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:476:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 476 | operator>=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:476:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/stl_iterator.h:520:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 520 | operator>=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:520:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1724:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1724 | operator>=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1724:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1781:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1781 | operator>=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1781:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>' 7 | while(on >= 0) { | ^ 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:739:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 739 | operator>=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:739:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/string_view:746: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> >)' 746 | operator>=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:746:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/string_view:754: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>)' 754 | operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:754:5: note: template argument deduction/substitution failed: a.cc:7:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/basic_string.h:3997:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3997 | operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3997:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 7 | while(on >= 0) { | ^ /usr/include/c++/14/bits/basic_string.h:4011:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 4011 | operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4011:5: note: template argument deduction/substitution failed: a.cc:7:15: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 7
s592998907
p04001
C++
#include <bits/stdc++.h> using namespace std; int solve(string S) { long long Ssize = S.size(); long long sum = 0; if (Ssize == 1) { int ss = S[0] - '0'; cout << ss << endl; return 0; } for (long long bit = 0; bit < (1 << (Ssize - 1)); bit++) { string num = ""; for (long long i = 0; i < Ssize; i++) { num += S[i]; if (bit & (1 << i)) //0:nasi 1:+ { cout << setbit<8>(1 << i) << endl; sum += stoll(num); num = ""; } } sum += stoll(num); } cout << sum << endl; return 0; } // Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) int main() { string S; cin >> S; solve(S); return 0; }
a.cc: In function 'int solve(std::string)': a.cc:23:25: error: 'setbit' was not declared in this scope; did you mean 'setuid'? 23 | cout << setbit<8>(1 << i) << endl; | ^~~~~~ | setuid a.cc:23:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 23 | cout << setbit<8>(1 << i) << endl; | ~~~~~~~~~^~~~~~~
s338380249
p04001
C++
#include <bits/stdc++.h> using namespace std; int solve(string S) { long long Ssize = S.size(); long long sum = 0; if (Ssize == 1) { int ss = S[0] - '0'; cout << ss << endl; return 0; } for (long long bit = 0; bit < (1 << (Ssize - 1)); bit++) { string num = ""; for (long long i = 0; i < Ssize; i++) { num += S[i]; if (bit & (1 << i)) //0:nasi 1:+ { cout << setbit<8>(1 << i) << endl; sum += stoll(num); num = ""; } } sum += stoll(num); } cout << sum << endl; return 0; } // Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) int main() { string S; cin >> S; solve(S); return 0; }
a.cc: In function 'int solve(std::string)': a.cc:23:25: error: 'setbit' was not declared in this scope; did you mean 'setuid'? 23 | cout << setbit<8>(1 << i) << endl; | ^~~~~~ | setuid a.cc:23:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 23 | cout << setbit<8>(1 << i) << endl; | ~~~~~~~~~^~~~~~~
s577462500
p04001
C++
#include <bits/stdc++.h> using namespace std; int solve(string S) { long long Ssize = S.size(); long long sum = 0; if (Ssize == 1) { int ss = S[0] - '0'; cout << ss << endl; return 0; } for (long long bit = 0; bit < (1 << (Ssize - 1)); bit++) { string num = ""; for (long long i = 0; i < Ssize; i++) { num += S[i]; if (bit & (1 << i)) //0:nasi 1:+ { cout << setbit<8>(1 << i) << endl; sum += stoll(num); num = ""; } } sum += stoll(num); } cout << sum << endl; return 0; } // Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) int main() { string S; cin >> S; solve(S); return 0; }
a.cc: In function 'int solve(std::string)': a.cc:23:25: error: 'setbit' was not declared in this scope; did you mean 'setuid'? 23 | cout << setbit<8>(1 << i) << endl; | ^~~~~~ | setuid a.cc:23:43: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 23 | cout << setbit<8>(1 << i) << endl; | ~~~~~~~~~^~~~~~~
s708632436
p04001
C
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) using ll = long long; int main(){ string s; cin >> s; int n = s.size(); ll ans = 0; for(int bit = 0; bit < (1 << (n-1)); bit++){ ll tmp = 0; for(int i = 0; i < n; i++){ if(i == n - 1){ tmp = tmp*10 + s[i] - '0'; }else if(bit & (1 << i)){ ans += tmp*10 + s[i] - '0'; tmp = 0; }else{ tmp = tmp*10 + s[i] - '0'; } } if(tmp > 0) ans += tmp; } cout << ans << endl; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s145894053
p04001
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) using namespace std; long long sum(int i, string &s){ int n = s.size()-1; vector<long long> part; part.push_back(s[0]-'0'); for(int j=0; j<n; j++){ if((i<<j)&1){ part.push_back(s[j+1]); } else{ part.back() *= 10; part.back() += s[j+1]; } } ll rtn = 0; for(int j=0; j<part.size(); j++){ rtn += part[j]; } return rtn; } int main(){ string s; cin >> s; int n = s.size()-1; long long ans = 0; rep(i, 1<<n){ ans += sum(i, s); } cout << ans << endl; return 0; }
a.cc: In function 'long long int sum(int, std::string&)': a.cc:20:3: error: 'll' was not declared in this scope 20 | ll rtn = 0; | ^~ a.cc:22:5: error: 'rtn' was not declared in this scope 22 | rtn += part[j]; | ^~~ a.cc:24:10: error: 'rtn' was not declared in this scope 24 | return rtn; | ^~~
s942204788
p04001
C++
#include <bits/stdc++.h> using namespace std; #define int long long int res = 0; string s; void dfs(int i, int sum, int psum, string &s) { int n = s.size(); int si = s.at(i) - '0'; if (i == n - 1) { res += sum + si + 10 * psum; return; } dfs(i + 1, sum + si + 10 * psum, 0, s); dfs(i + 1, sum, 10 * psum + si, s); } signed main() { cin >> s; dfs(0, 0, 0, s); cout << res << endl; } int res = 0; dfs(0, 0, s); cout << res << endl; }
a.cc:21:7: error: redefinition of 'long long int res' 21 | int res = 0; | ^~~ a.cc:4:5: note: 'long long int res' previously defined here 4 | int res = 0; | ^~~ a.cc:22:6: error: expected constructor, destructor, or type conversion before '(' token 22 | dfs(0, 0, s); | ^ a.cc:23:3: error: 'cout' does not name a type 23 | cout << res << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s307283829
p04001
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size() - 1; int res = 0; for (int bit = 0; bit < (1<<n); bit++) { int sum = 0; for (int i = 0; i < n; i++) { int si = s.at(i) - '0' if ((1<<i) & bit) { res = res + 10 * sum + si; sum = 0; } else { sum = si + sum * 10; } } res += 10 * sum; res += (int)s.at(n) - '0'; } cout << res << endl; }
a.cc: In function 'int main()': a.cc:13:7: error: expected ',' or ';' before 'if' 13 | if ((1<<i) & bit) { | ^~ a.cc:17:7: error: 'else' without a previous 'if' 17 | else { | ^~~~
s336174439
p04001
C
#include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #include<vector> using namespace std; #define ll long long int n; string ss; vector<int> now; ll ans; void dfs(int cur) { if(cur==n-1) { now.push_back(n-1); ll pre=0; int last=-1; for(int i=0;i<(int)now.size();i++) { for(int pos=last+1;pos<=now[i];pos++) pre=pre*(ll)10+(ll)(ss[pos]-'0'); last=now[i]; ans+=pre; pre=0; } now.pop_back(); return; } dfs(cur+1); now.push_back(cur); dfs(cur+1); now.pop_back(); return; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>ss; n=(int)ss.length(); dfs(0); cout<<ans<<'\n'; return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s453798274
p04001
C
#include <bits/stdc++.h> using namespace std; string s; vector<int> v; long long ans=0; long long sti(int l,int r){ long long sum=0; for(int i=l;i<=r;i++){ sum=sum*10+s[i]-'0'; } return sum; } void dfs(){ if(v.size()+1==s.size()){ long long l=0,sum=0; for(int i=0;i<s.size()-1;i++){ if(v[i]==1){ sum+=sti(l,i); l=i+1; } } sum+=sti(l,s.size()-1); //cout<<sum<<endl; ans+=sum; }else{ v.push_back(0); dfs(); v.pop_back(); v.push_back(1); dfs(); v.pop_back(); } } int main(){ cin>>s; dfs(); cout<<ans<<endl; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s721753259
p04001
C++
#include<iostream> #include<cmath> using namespace std; int main(){ long long sum = 0; string S; cin >> S; int n = S.size(); for (int i = 0; i < pow(2, n-1);i++){ long long part = 0; for(int j = 0; j < n-1;j++){ part *= 10; part += (int)(S[j] - '0'); if((i & (int)pow(2, j)) != 0){ sum += part; part = 0; } } part *= 10; part += (int)(S[n-1] - '0'); sum += part; }
a.cc: In function 'int main()': a.cc:27:6: error: expected '}' at end of input 27 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s264147981
p04001
C++
#include <bits/stdc++.h> using namespace std; long long calc(string s) { int len = s.length(); long long sum ; sum = stoll(s); for(int i=1;i<len;i++) { string left =s.substr(0,i); sum += stoll(left) * pow(2,len-i-1); string right = substr(i,len-i); sum += calc(right); } return sum; } int main() { string s; cin>>s; long long sum = calc(s); cout<<sum<<endl; } //standlineさん参考
a.cc: In function 'long long int calc(std::string)': a.cc:17:24: error: 'substr' was not declared in this scope; did you mean 'strstr'? 17 | string right = substr(i,len-i); | ^~~~~~ | strstr
s072496301
p04001
C++
#include <bits/stdc++.h> using namespace std; long long calc(string s) { int len = s.length(); long long sum ; sum = stoll(s); for(int i=1;i<len;i++) { string left =s.substr(0,i); sum += stoll(left) * pow(2,len-i-1); string right = substr(i,len-i); sum += calc(right); } return sum; } int main() { string s; cin>>s; long long sum = calc(s); cout<<calc<<endl; } //standlineさん参考
a.cc: In function 'long long int calc(std::string)': a.cc:17:24: error: 'substr' was not declared in this scope; did you mean 'strstr'? 17 | string right = substr(i,len-i); | ^~~~~~ | strstr
s059712800
p04001
C++
#include <bits/stdc++.h> using namespace std; long f(long n) { if (n < 10) return n; long a = 100, b = 1, c = 11; while (true) { if (n < a) return n/(a/10)*c + f(n%(a/10))*2; a *= 10; b *= 2; c = 10*c + b; } } long main() { long x; cin >> x; cout << f(x) << endl; }
cc1plus: error: '::main' must return 'int'
s336265703
p04001
C++
#include <bits/stdc++.h> using namespace std; int sum_plus(string &S, string plus, int n, int ans) { int sum = 0; if (n == 0) { sum = S.at(0); for (int i = 0; i < plus.size(); i++) { if (plus.at(i) == "0") { sum *= 10; sum += S.at(i + 1); } else { ans += sum; sum = S.at(i + 1); } if (i == plus.size() - 1) { ans += sum; } } plus.pop_back(); } if (n > 0) { sum_plus(S, plus + "0", n - 1, ans); sum_plus(S, plus + "1", n - 1, ans); } return ans; } int main() { string S, plus; cin >> S; int ans = 0; cout << sum_plus(S, plus, S.size() - 1, ans) << endl; }
a.cc: In function 'int sum_plus(std::string&, std::string, int, int)': a.cc:9:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if (plus.at(i) == "0") { | ~~~~~~~~~~~^~~~~~
s404713052
p04001
C++
#include <bits/stdc++.h> using namespace std; int sum_plus(string &S, string plus, int n, int ans) { int sum = 0; if (n == 0) { sum = S.at(0); for (int i = 0; i < plus.size(); i++) { if (plus.at(i) == "0") { sum *= 10; sum += S.at(i + 1); } else { ans += sum; sum = S.at(i + 1); } if (i == plus.size() - 1) { ans += sum; } } plus.pop_back; } if (n > 0) { sum_plus(S, plus + "0", n - 1, ans); sum_plus(S, plus + "1", n - 1, ans); } return ans; } int main() { string S, plus; cin >> S; int ans = 0; cout << sum_plus(S, plus, S.size() - 1, ans) << endl; }
a.cc: In function 'int sum_plus(std::string&, std::string, int, int)': a.cc:9:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if (plus.at(i) == "0") { | ~~~~~~~~~~~^~~~~~ a.cc:21:10: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 21 | plus.pop_back; | ~~~~~^~~~~~~~ In file included 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, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here 2174 | pop_back() noexcept | ^~~~~~~~