submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s675639645
p03929
C++
#include<bits/stdc++.h> using namespace std; int map[12][6]={ {4,2,0,9,7}, {1,10,8,6,4}, {9,7,5,3,1}, {6,4,2,0,9}, {3,1,10,8,6}, {0,9,7,5,3}, {8,6,4,2,0}, {5,3,1,10,8}, {2,0,9,7,5}, {10,8,6,4,2}, {7,5,3,1,10}}; int main() { int n,k,ans=0; cin>>n>>k; for(int i=2;i<n;i++) for(int j=2;j<7;j++) { if(map[i][j]==k)ans++; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:28: error: reference to 'map' is ambiguous 22 | if(map[i][j]==k)ans++; | ^~~ 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:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:3:5: note: 'int map [12][6]' 3 | int map[12][6]={ | ^~~
s008978190
p03929
C++
#include<bits/stdc++.h> using namespace std; int n,k,ans,p; int map[12][6]={{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},{6,4,2,0,9},{3,1,10,8,6},{0,9,7,5,3},{8,6,4,2,0},{5,3,1,10,8},{2,0,9,7,5},{10,8,6,4,2},{7,5,3,1,10}}; int main() { scanf("%d%d",&n,&k);n-=2; p=n%11;n/=11; ans=n*5; for(int i=0;i<p;i++) for(int j=0;j<5;j++) if(map[i][j]==k)ans++; printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:12:10: error: reference to 'map' is ambiguous 12 | if(map[i][j]==k)ans++; | ^~~ 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:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:4:5: note: 'int map [12][6]' 4 | int map[12][6]={{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},{6,4,2,0,9},{3,1,10,8,6},{0,9,7,5,3},{8,6,4,2,0},{5,3,1,10,8},{2,0,9,7,5},{10,8,6,4,2},{7,5,3,1,10}}; | ^~~
s517389561
p03929
C++
#include<bits/stdc++.h> using namespace std; int n,k,ans,p; int map[12][6]={ {4,2,0,9,7}, {1,10,8,6,4}, {9,7,5,3,1}, {6,4,2,0,9}, {3,1,10,8,6}, {0,9,7,5,3}, {8,6,4,2,0}, {5,3,1,10,8}, {2,0,9,7,5}, {10,8,6,4,2}, {7,5,3,1,10}}; int main() { scanf("%d%d",&n,&k);n-=2; p=n%11;n/=11; ans=n*5; for(int i=0;i<p;i++) for(int j=0;j<5;j++) if(map[i][j]==k)ans++; printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:23:10: error: reference to 'map' is ambiguous 23 | if(map[i][j]==k)ans++; | ^~~ 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:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:4:5: note: 'int map [12][6]' 4 | int map[12][6]={ | ^~~
s159498070
p03929
C++
#include<bits/stdc++.h> using namespace std; int n,k,ans,p; int map[12][6]={{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},{6,4,2,0,9}, {3,1,10,8,6},{0,9,7,5,3},{8,6,4,2,0},{5,3,1,10,8},{2,0,9,7,5}, {10,8,6,4,2},{7,5,3,1,10}}; int main() { scanf("%d%d",&n,&k);n-=2; p=n%11;n/=11; ans=n*5; for(int i=0;i<p;i++) for(int j=0;j<5;j++) if(map[i][j]==k)ans++; printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:14:10: error: reference to 'map' is ambiguous 14 | if(map[i][j]==k)ans++; | ^~~ 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:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:4:5: note: 'int map [12][6]' 4 | int map[12][6]={{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},{6,4,2,0,9}, | ^~~
s703285930
p03929
C++
#include<bits/stdc++.h> using namespace std; int n,m,ans; int map[12][6]={{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},{6,4,2,0,9},{3,1,10,8,6}, {0,9,7,5,3},{8,6,4,2,0},{5,3,1,10,8},{2,0,9,7,5},{10,8,6,4,2},{7,5,3,1,10}}; int main(){ cin>>n>>m; ans=((n-2)/11)*5; for(int i=0;i<(n-2)%11;i++) for(int j=0;j<5;j++) if(map[i][j]==m) ans++; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:16: error: reference to 'map' is ambiguous 11 | if(map[i][j]==m) ans++; | ^~~ 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:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:4:5: note: 'int map [12][6]' 4 | int map[12][6]={{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},{6,4,2,0,9},{3,1,10,8,6}, | ^~~
s880443411
p03929
C++
#include<bits/stdc++.h> using namespace std; int n,k,ans,p; int map[12][6]={ {4,2,0,9,7}, {1,10,8,6,4}, {9,7,5,3,1}, {6,4,2,0,9}, {3,1,10,8,6}, {0,9,7,5,3}, {8,6,4,2,0}, {5,3,1,10,8}, {2,0,9,7,5}, {10,8,6,4,2}, {7,5,3,1,10}}; int main() { scanf("%d%d",&n,&k);n-=2; p=n%11;n/=11; ans=n*5; for(int i=0;i<p;i++) for(int j=0;j<5;j++) if(map[i][j]==k)ans++; printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:23:10: error: reference to 'map' is ambiguous 23 | if(map[i][j]==k)ans++; | ^~~ 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:1: /usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map' 102 | class map | ^~~ a.cc:4:5: note: 'int map [12][6]' 4 | int map[12][6]={ | ^~~
s159253608
p03929
C++
#include<bits/stdc++.h> using namespace std; int a[11,5]= {4,2,0,9,7}, {1,10,8,6,4}, {9,7,5,3,1}, {6,4,2,0,9}, {3,1,10,8,6}, {0,9,7,5,3}, {8,6,4,2,0}, {5,3,1,10,8}, {2,0,9,7,5}, {10,8,6,4,2}, {7,5,3,1,10}; int n,s=0,i,j,k,a; int main() { cin>>n>>k; s+=(n/11)*5;a=n%11; for(i=0;i<a;i++) for(j=0;j<5;j++) if(a[i][j]=k) s++; cout<<s<<endl; return 0; }
a.cc:3:11: error: expected ']' before ',' token 3 | int a[11,5]= | ^ | ] a.cc:3:12: error: expected unqualified-id before numeric constant 3 | int a[11,5]= | ^ a.cc:4:16: error: expected unqualified-id before ',' token 4 | {4,2,0,9,7}, | ^ a.cc:5:5: error: expected unqualified-id before '{' token 5 | {1,10,8,6,4}, | ^ a.cc:5:17: error: expected unqualified-id before ',' token 5 | {1,10,8,6,4}, | ^ a.cc:6:5: error: expected unqualified-id before '{' token 6 | {9,7,5,3,1}, | ^ a.cc:6:16: error: expected unqualified-id before ',' token 6 | {9,7,5,3,1}, | ^ a.cc:7:5: error: expected unqualified-id before '{' token 7 | {6,4,2,0,9}, | ^ a.cc:7:16: error: expected unqualified-id before ',' token 7 | {6,4,2,0,9}, | ^ a.cc:8:5: error: expected unqualified-id before '{' token 8 | {3,1,10,8,6}, | ^ a.cc:8:17: error: expected unqualified-id before ',' token 8 | {3,1,10,8,6}, | ^ a.cc:9:5: error: expected unqualified-id before '{' token 9 | {0,9,7,5,3}, | ^ a.cc:9:16: error: expected unqualified-id before ',' token 9 | {0,9,7,5,3}, | ^ a.cc:10:5: error: expected unqualified-id before '{' token 10 | {8,6,4,2,0}, | ^ a.cc:10:16: error: expected unqualified-id before ',' token 10 | {8,6,4,2,0}, | ^ a.cc:11:5: error: expected unqualified-id before '{' token 11 | {5,3,1,10,8}, | ^ a.cc:11:17: error: expected unqualified-id before ',' token 11 | {5,3,1,10,8}, | ^ a.cc:12:5: error: expected unqualified-id before '{' token 12 | {2,0,9,7,5}, | ^ a.cc:12:16: error: expected unqualified-id before ',' token 12 | {2,0,9,7,5}, | ^ a.cc:13:5: error: expected unqualified-id before '{' token 13 | {10,8,6,4,2}, | ^ a.cc:13:17: error: expected unqualified-id before ',' token 13 | {10,8,6,4,2}, | ^ a.cc:14:5: error: expected unqualified-id before '{' token 14 | {7,5,3,1,10}; | ^ a.cc: In function 'int main()': a.cc:22:13: error: invalid types 'int[int]' for array subscript 22 | if(a[i][j]=k) | ^
s309860914
p03929
C++
#include <bits/stdc++.h> using namespace std; int main() { long long n, l, a = 0; cin >> n >> k; if(k < 3){ cout << 0 << endl; return 0; } vector<long long> vec; for(long long i = 0; i < n - 2; i++){ for(int j = 0; j < k; j++){ if((i * 3 + (i + 1) * 3 + (i + 2) * 3 + 18 + 3 * j) % 11 == 7){ a++; } } } cout << a << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:21: error: 'k' was not declared in this scope 5 | cin >> n >> k; | ^
s924046811
p03929
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> #include <map> #include <stdio.h> using namespace std; using ll = int long long; map <int ,int> mpa,mpb; int main(){ int n,k; cin >> n >>k; int A[n+1][8]={0}; ll ans=0; for(int i=1;i<=n;i++){ for(int j=1;j<=7;j++){ A[i][j]=7*i+j-7; } } ll sum=0; for(int i=2;i<=n-1;i++){ for(int j=2;j<=6;j++){ sum=((A[i][j]%11)*9; if(sum%11==k){ ans++; } } } cout << ans<< endl; }
a.cc: In function 'int main()': a.cc:28:25: error: expected ')' before ';' token 28 | sum=((A[i][j]%11)*9; | ~ ^ | )
s027313429
p03929
C
#include <stdio.h> #include <stdlib.h> #include <stddef.h> int main() { int n,k,i,j,i1,j1,c,b; scanf("%d %d",&n,&k); c = 0; i1 = j1 = -1; for(i=0;i<=n-3;i++){ for(j=1;j<=5;j++){ if( ( 9*( 7*i+j ) + 72 ) % 11 == k ){ i1 = i; j1 = j; c++; break; } } if( i1>=0 ) break; } if(c==0){ printf("0\n"); return EXIT_SUCCESS; } b = ( n-3 - i1)/11; if(b>0){ i1 += b*11; c += 5*b; } c--; for(i=i1;i<=n-3;i++){ for(j=1;j<=5;j++){ if( ( 9*( 7*i+j ) + 72 ) % 11 == k ){ c++; } } } printf("%d\n",c); #include <stdio.h> #include <stdlib.h> #include <stddef.h> int main() { int n,k,i,j,i1,j1,c,b; scanf("%d %d",&n,&k); c = 0; i1 = j1 = -1; for(i=0;i<=n-3;i++){ for(j=1;j<=5;j++){ if( ( 9*( 7*i+j ) + 72 ) % 11 == k ){ i1 = i; j1 = j; c++; break; } } if( i1>=0 ) break; } if(c==0){ printf("0\n"); return EXIT_SUCCESS; } b = ( n-3 - i1)/11; if(b>0){ i1 += b*11; c += 5*b; } c--; for(i=i1;i<=n-3;i++){ for(j=1;j<=5;j++){ if( ( 9*( 7*i+j ) + 72 ) % 11 == k ){ c++; } } } printf("%d\n",c); }
main.c: In function 'main': main.c:83:1: error: expected declaration or statement at end of input 83 | } | ^
s838150099
p03929
C++
#include "stdio.h" #define long long __int64; __int64 a[11] = {3,8,2,7,1,6,0,5,10,4,9}; int main() { __int64 n,k,sum,i; while (scanf ("%lld%lld",&n,&k) != EOF) { n = 7*n-16; sum = n/11 - n/77*2; if (a[k] <= n%11) { sum++; } for (i=a[k];i<=n%77;i+=11) { if (i%7 == 6 || i%7 == 0) { sum--; } } printf ("%lld\n",sum); } return 0; }
a.cc:4:1: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | __int64 a[11] = {3,8,2,7,1,6,0,5,10,4,9}; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:7:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 7 | __int64 n,k,sum,i; | ^~~~~~~ | __int64_t a.cc:8:31: error: 'n' was not declared in this scope 8 | while (scanf ("%lld%lld",&n,&k) != EOF) | ^ a.cc:8:34: error: 'k' was not declared in this scope 8 | while (scanf ("%lld%lld",&n,&k) != EOF) | ^ a.cc:11:9: error: 'sum' was not declared in this scope 11 | sum = n/11 - n/77*2; | ^~~ a.cc:12:13: error: 'a' was not declared in this scope 12 | if (a[k] <= n%11) | ^ a.cc:16:14: error: 'i' was not declared in this scope 16 | for (i=a[k];i<=n%77;i+=11) | ^ a.cc:16:16: error: 'a' was not declared in this scope 16 | for (i=a[k];i<=n%77;i+=11) | ^
s488627083
p03929
C++
#include "stdio.h" __int64 a[11] = {3,8,2,7,1,6,0,5,10,4,9}; int main() { __int64 n,k,sum,i; while (scanf ("%I64d%I64d",&n,&k) != EOF) { n = 7*n-16; sum = n/11 - n/77*2; if (a[k] <= n%11) { sum++; } for (i=a[k];i<=n%77;i+=11) { if (i%7 == 6 || i%7 == 0) { sum--; } } printf ("%I64d\n",sum); } return 0; }
a.cc:2:1: error: '__int64' does not name a type; did you mean '__int64_t'? 2 | __int64 a[11] = {3,8,2,7,1,6,0,5,10,4,9}; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:5:5: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 5 | __int64 n,k,sum,i; | ^~~~~~~ | __int64_t a.cc:6:33: error: 'n' was not declared in this scope 6 | while (scanf ("%I64d%I64d",&n,&k) != EOF) | ^ a.cc:6:36: error: 'k' was not declared in this scope 6 | while (scanf ("%I64d%I64d",&n,&k) != EOF) | ^ a.cc:9:9: error: 'sum' was not declared in this scope 9 | sum = n/11 - n/77*2; | ^~~ a.cc:10:13: error: 'a' was not declared in this scope 10 | if (a[k] <= n%11) | ^ a.cc:14:14: error: 'i' was not declared in this scope 14 | for (i=a[k];i<=n%77;i+=11) | ^ a.cc:14:16: error: 'a' was not declared in this scope 14 | for (i=a[k];i<=n%77;i+=11) | ^
s993365337
p03929
C++
#include <iostream> #include <cstdio> #include <cmath> #include <complex> #include <vector> #include <algorithm> using namespace std; typedef complex<double> Point; int n, k; Point to_point(int i) { double pai = 3.14159265358979; return exp(complex<double>(0, 2 * pai * i / n)); } Point to_vector(int i, int j) { return to_point(j) - to_point(i); } double _cross(Point &u, Point &v) { return imag(conj(u) * v); } //i < j < k double area(int i, int j, int k) { //面積を返す double ret = _cross(to_vector(i, j), to_vector(i, k)); return ret / 2; } signed main() { int i, j, l; scanf("%d%d", &n, &k); if (n > 100) return 0; k = k - 1; static vector<double> vec; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { for (l = j + 1; l < n; l++) { vec.push_back(area(i, j, l)); } } } sort(vec.begin(), vec.end()); printf("%.14f\n", vec[k]); return 0; }
a.cc: In function 'double area(int, int, int)': a.cc:28:38: error: cannot bind non-const lvalue reference of type 'Point&' {aka 'std::complex<double>&'} to an rvalue of type 'Point' {aka 'std::complex<double>'} 28 | double ret = _cross(to_vector(i, j), to_vector(i, k)); | ~~~~~~~~~^~~~~~ a.cc:22:22: note: initializing argument 1 of 'double _cross(Point&, Point&)' 22 | double _cross(Point &u, Point &v) { | ~~~~~~~^
s556031413
p03929
C++
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<climits> #include<algorithm> using namespace std; int main() { int n,k; long long sum; int cnt=0; scanf("%d%d",&n,&k); for(int i=1;i<=n-2;i++) for(int j=1;j<=5;j++) { sum=3*(7*(3*i+3)+3*j-21)+9; if( cnt++; } if(cnt==0) printf("0\n"); else printf("%d\n",cnt); return 0; }
a.cc: In function 'int main()': a.cc:20:3: error: expected primary-expression before '}' token 20 | } | ^ a.cc:18:17: error: expected ')' before '}' token 18 | if( cnt++; | ~ ^ | ) 19 | 20 | } | ~ a.cc:20:3: error: expected primary-expression before '}' token 20 | } | ^
s186139000
p03929
C++
#include <iostream> using namespace std; #define rep(i,n) for (int i=0;i<(n);i++) #include <string> #include <vector> #include <algorithm> #include <map> int main() { int n, k,cnt=0,st=0; bool memo[10]; memset(memo, false, 10); cin >> n >> k; rep(i, n) { st = (7 * i * 9 + 81) % 11; if (memo[st] == false) if (st == k || (st + 9) % 11 == k || (st + 7) % 11 == k || (st + 5) % 11 == k || (st + 3) % 11 == k) { cnt++; memo[st] = true; } else; else cnt++; } cout << cnt << endl; }
a.cc: In function 'int main()': a.cc:12:9: error: 'memset' was not declared in this scope 12 | memset(memo, false, 10); | ^~~~~~ a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 8 | #include <map> +++ |+#include <cstring> 9 | int main() {
s768996554
p03929
C++
#include <bits/stdc++.h> using namespace std; struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vector<int> > vii; typedef queue<int> qi; typedef stack<int> si; typedef deque<int> dqi; #define reps(i, a, b) for (int i = a; i < b; ++i) #define rep(i, n) reps(i, 0, n) #define REPS(i, a, b) reps(i, a, b) #define REP(i, n) rep(i, n) #define deps(i, a, b) for (int i = a; i >= b; --i) #define dep(i, n) deps(i, n, 0) #define DEPS(i, a, b) deps(i, a, b) #define DEP(i, n) dep(i, n) #define pf push_front #define pb push_back #define mp make_pair #define fst first #define FST fst #define sec second #define SEC sec #define sz(obj) ((int)(obj).size()) #define all(v) (v).begin(), (v).end() #define ALL(v) all(v) const int INF = 999999999; const int MOD = 1e9 + 7; const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;} inline int in() {int x; std::cin >> x; return x;} template <typename T> void print(std::vector<T>& v, char c = ' ') { REP(i, v.size()) { if (i != 0) std::cout << c; std::cout << v[i]; } std::cout << endl; } template <typename T> void print(T x) { std::cout << x << '\n'; } signed main() { int n = in(), k = in(); print(n - 1) * 5 / 11; return (0); }
a.cc: In function 'int main()': a.cc:53:16: error: invalid operands of types 'void' and 'int' to binary 'operator*' 53 | print(n - 1) * 5 / 11; | ~~~~~~~~~~~~ ^ ~ | | | | void int
s621936201
p03929
C++
#include <iostream> #include <iomanip> #include <string> #include <vector> #include <queue> #include <algorithm> #include <utility> #include <cmath> #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(void){ ll n, k; cin >> n >> k; ll ans[11] = {0}; REP(i, 11){ ll res = 0; REP(j, 5){ if((63*(i+1)+9*(j+1)+9) % 11 == k){ res++; } } ans[i] = res; } unsigned ll res = 0; if(n >= 11){ REP(i, 11){ res += ans[i]; } } res = res*(n/11); REP(i, n%11-2){ res += ans[i]; } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:75:21: error: expected initializer before 'res' 75 | unsigned ll res = 0; | ^~~ a.cc:78:25: error: 'res' was not declared in this scope 78 | res += ans[i]; | ^~~ a.cc:81:9: error: 'res' was not declared in this scope 81 | res = res*(n/11); | ^~~
s176959743
p03929
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include <queue> #include <cstring> using namespace std; const ll chart[11][5] = { {9,10,0,1,2}, {5,6,7,8,9}, {1,2,3,4,5}, {8,9,10,0,1}, {4,5,6,7,8}, {0,1,2,3,4}, {7,8,9,10,0}, {3,4,5,6,7}, {10,0,1,2,3}, {6,7,8,9,10}, {2,3,4,5,6}, }; using ll = long long; ll n, k; int main(void) { scanf("%lld %lld", &n, &k); if (n <= 2)return 0 * printf("0\n"); n -= 2; ll big = n / 11; ll small = n % 11; ll cnt[11] = {}; fill(cnt, cnt + 11, 0); for (ll i = 0; i < 11; ++i) { for (ll j = 0; j < 5; ++j) { ++cnt[chart[i][j]]; } } ll ans = cnt[k] * big; fill(cnt, cnt + 11, 0); for (ll i = 0; i < small; ++i) { for (ll j = 0; j < 5; ++j) { ++cnt[chart[i][j]]; } } ans += cnt[k]; printf("%lld\n", ans); return 0; }
a.cc:23:7: error: 'll' does not name a type 23 | const ll chart[11][5] = | ^~ a.cc: In function 'int main()': a.cc:54:31: error: 'chart' was not declared in this scope; did you mean 'char'? 54 | ++cnt[chart[i][j]]; | ^~~~~ | char a.cc:63:31: error: 'chart' was not declared in this scope; did you mean 'char'? 63 | ++cnt[chart[i][j]]; | ^~~~~ | char
s316854504
p03930
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define ll long long #define all(v) v.begin(), v.end() int main(){ int h,w,k;cin>>h>>w>>k;vector<vector<int>> c(h,vector<int>(w)); //int i,j,l,n,p; rep(i,h)rep(j,w){ char ch;cin>>ch; c[i][j]=(ch-'0'); } int ans=0; rep(i,h)rep(j,w){ bool update=1;vector<vector<int>> m=c; m[i][j]=0;int score=0,timev=1; while(update) { update=0; rep(n,w){ int to=h-1; for(l=h-1;l>=0;l--){ if(m[l][n]!=0){ swap(m[to][n],m[l][n]);to--; } } } int get=0; rep(l,h){ int from=0,now=m[l][w-1]; rep(n,w){ if(now!=m[l][n]){ int dis=(n-1)-from+1; if(dis>=k){ for(p=from;p<n;p++) { get+=m[l][p];m[l][p]=0; } }from=n;now=m[l][n]; } } int dis=(w-1)-from+1; if(dis>=k){ for(p=from;p<n;p++){ get+=m[l][p];m[l][p]=0; } } } if(get>0)update=1; else break; score+=timev*get; timev*=2; }ans=max(ans,score); }cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:21:13: error: 'l' was not declared in this scope 21 | for(l=h-1;l>=0;l--){ | ^ a.cc:34:19: error: 'p' was not declared in this scope 34 | for(p=from;p<n;p++) { | ^ a.cc:42:15: error: 'p' was not declared in this scope 42 | for(p=from;p<n;p++){ | ^ a.cc:42:24: error: 'n' was not declared in this scope 42 | for(p=from;p<n;p++){ | ^
s004733109
p03930
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int,int>; int H, W, K; void fall(vector<vector<int>> &c) { rep(i,W) rep(j,H) { if (c[i][j] == 0) { for (int k = 1; k + j < H; ++k) { if (c[i][k+j] != 0) { for (int l = j; l < H; ++l) { if (l + k < H) c[i][l] = c[i][l+k]; else c[i][l] = 0; } break; } } } } } void sum(ll &ans, ll delete_cnt, vector<vector<int>> &c) { rep(i,H) { ll left = 0; rep(j,W) { if (c[j+1][i] != 0 && c[j+1][i] == c[j][i]) continue; if (c[j+1][i] != c[j][i]) { if (j - left + 1 > 1) { ans += (1LL<<delete_cnt) * (j - left + 1) * c[j][i]; for (int k = left; k <= j; ++k) c[k][i] = 0; } } left = j + 1; } } } ll calc_ans(int x, int y, vector<vector<int>> c) { ll res = 0; ll pre_ans = -1; ll delete_cnt = 0; c[x][y] = 0; fall(c); while (res != pre_ans) { pre_ans = res; sum(res, delete_cnt, c); fall(c); ++delete_cnt; } return res; } int main() { cin >> H >> W >> K; vector<vector<ll>> c(W+1, vector<ll>(H)); rep(i,H) { string S; cin >> S; rep(j,W) c[j][H-1-i] = S[j] - '0'; } ll ans = 0; rep(i,W) rep(j,H) { if (i == 0) continue; ans = max(ans, calc_ans(i, j, c)); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:73:39: error: could not convert 'c' from 'vector<vector<long long int>>' to 'vector<vector<int>>' 73 | ans = max(ans, calc_ans(i, j, c)); | ^ | | | vector<vector<long long int>>
s510202898
p03930
C++
/* Problem 93 https://atcoder.jp/contests/s8pc-3/tasks/s8pc_3_b */ #include <bits/stdc++.h> using namespace std; /* typedef */ typedef long long ll; typedef pair<int, int> pii; /* class */ class pazzle { public: int H, W, K; ll ans = 0; vector<vector<int> > v; pazzle (int H, int W, int K, vector<vector<int> > v) : H(H), W(W), K(K), v(v) {} bool del() { int ret = false; for (int i = 0; i < H; i++) { int r = 0; for (int l = 0; l < W; l++) { int tmp = v[i][r]; while (v[i][r] == -1) { r++; l++; } while (v[i][r] == v[i][r + 1]){ r++; tmp += v[i][r]; } if (r - l + 1>= K) { for (int k = l; k <= r; k++) v[i][k] = -1; ans += tmp; ret = true; } l = r; r++; } } return ret; } void move() { for (int i = 0; i < W; i++) { for (int j = H - 1; j > 0; j--) { if (v[j][i] == -1) { int k = j - 1; while (v[k][i] == -1 && k > 0) k--; if (v[k][i] != -1) swap(v[k][i], v[j][i]); } } } } void printPoint() { cout << ans << '\n'; } ll gameStart() { ll ret = 0; move(); for (int i = 0; del(); i++){ move(); ret += pow(2, i) * ans; ans = 0; } return ret; } }; /* constant */ /* global variables */ /* function */ /* main */ int main(){ int H, W, K; cin >> H >> W >> K; vector<string> vs(H); for (int i = 0; i < H; i++) cin >> vs[i]; vector<vector<int> > v(H, vector<int> (W + 1, -2)); for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) v[i][j] = vs[i][j] - '0'; if (K == 1) { int ans = 0; int minValue = INF; for (auto vi : v) { ans += accumulate(vi.begin(), vi.end(), 0); minValue = min(*min_element(vi.begin(), vi.end()), minValue); } cout << ans - minValue << '\n'; return 0; } ll ans = 0; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { int tmp = v[i][j]; v[i][j] = -1; pazzle P = pazzle(H, W, K, v); ans = max(ans, P.gameStart()); v[i][j] = tmp; } } cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:81:24: error: 'INF' was not declared in this scope 81 | int minValue = INF; | ^~~
s993928967
p03930
C++
tifkukhj kuyljhlikljk lgykihlkjhivkhuijj dtuuuuuuuuudhg ghjfyudt tukuyfyjkf dtukyfkyfukyukfyhf fghjuk u
a.cc:1:1: error: 'tifkukhj' does not name a type 1 | tifkukhj | ^~~~~~~~
s719347395
p03930
C++
17 17 2 12345678912345678 23456789123456789 34567891234567891 45678912345678912 56789123456789123 67891234567891234 78912345678912345 89123456789123456 91234567891234567 12345678912345678 23456789123456789 34567891234567891 45678912345678912 56789123456789123 67891234567891234 78912345678912345 89123456789123456
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 17 17 2 | ^~
s961921360
p03931
C++
#include <bits/stdc++.h> typedef long long ll; const int MOD = 1e9 + 7; using namespace std; //-------------------------↓↓↓↓↓↓------------------------ int main(void){ cin.tie(0); ios::sync_with_stdio(false); ll n, k, a[100 + 10], dp[100 + 10][100 + 10][255 + 100], add = 1, ans = 0; //こういうのはDP、とるか否かの2通りで //dp[i][j][k] := i番目まで、jが数列の長さ, kがxorしたやつの値 cin >> n >> k; for(int i = 0; i < n ; i++){ cin >> a[i]; } for(int i = 0; i < n + 5; i++){ for(int j = 1; j < n + 1 + 5; j++){ for(int kk = 0; kk < k + 10; kk++){ dp[i][j][kk] = 0; } } } dp[0][0][0] = 1; for(int i = 0; i < n; i++){ for(int j = 0; j < n + 1; j++){ for(int kk = 0; kk < k + 7; kk++){ dp[i + 1][j][kk] += dp[i][j][kk]; dp[i + 1][j][kk] %= MOD; if(j != 0){ dp[i + 1][j][kk] += dp[i][j - 1][kk ^ a[i]]; dp[i + 1][j][kk] %= MOD; } } } } for(int i = 1; i < n + 1; i++){ add *= i; add %= MOD; (ans += ((dp[n][i][k] % MOD) * (add % MOD) % MOD); ans %= MOD; } cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:42:58: error: expected ')' before ';' token 42 | (ans += ((dp[n][i][k] % MOD) * (add % MOD) % MOD); | ~ ^ | )
s023889097
p03931
C++
#include<bits/stdc++.h> using namespace std; #define inf 1e9 #define ll long long #define ull unsigned long long #define M 1000000007 #define P pair<int,int> #define PLL pair<ll,ll> #define FOR(i,m,n) for(int i=m;i<n;i++) #define RFOR(i,m,n) for(int i=m;i>=n;i--) #define rep(i,n) FOR(i,0,n) #define rrep(i,n) RFOR(i,n,0) const int vx[4] = {0,1,0,-1}; const int vy[4] = {1,0,-1,0}; #define PI 3.14159265 int n,k; ll a[1000000]; ll c[1000000]; ll ans; ll dp[300][300][300]; int main(){ cin>>n>>k; rep(i,n){ cin>>a[i+1]; } c[1]=1; FOR(i,2,n+1){ c[i]=c[i-1]*i%M; } dp[0][0][0]=1; FOR(i,1,n+1){ rep(j,n+1){ rep(l,300){ int nk = l^a[i]; dp[i][nk][j+1]+=dp[i-1][l][j]; dp[i][l][j]+=dp[i-1][l][j]; } } } FOR(i,1,n+1){ ans+=(dp[n][k][i]*c[i]%M; ans%=M; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:48:29: error: expected ')' before ';' token 48 | ans+=(dp[n][k][i]*c[i]%M; | ~ ^
s760890943
p03931
C++
#include<algorithm> #include<iostream> #include<vector> using namespace std; typedef long long lint; typedef vector<int>vi; typedef pair<int,int>pii; #define rep(i,n)for(int i=0;i<(int)(n);++i) const lint mod=1e9+7; const int N=100000; lint fact[N]; lint invfact[N]; static long powerMod(long x, long exponent) { long prod = 1; for (int i = 63; i >= 0; --i) { prod = (prod * prod) % mod; if ((exponent & 1L << i) != 0) { prod = (prod * x) % mod; } } return prod; } static void initialize() { fact[0] = invfact[0] = 1; for (int i = 1; i < N; ++i) fact[i] = (i * fact[i - 1]) % mod; invfact[N-1]=powerMod(fact[N-1],mod-2); for(int i=N-2;i>=0;--i) invfact[i] = invfact[i+1]*(i+1)%mod; } void add(lint &x,lint y){ x=(x+y)%mod; } int n,k; int a[101]; lint dp[101][256]; lint dp2[101][256]; int main(){ initialize(); cin>>n>>k; rep(i,n)cin>>a[i]; dp[0][0]=1; rep(i,n){ memset(dp2,0,sizeof(dp2)); rep(j,i+1){ rep(b,256){ add(dp2[j][b],dp[j][b]); add(dp2[j+1][b^a[i]],dp[j][b]); } } swap(dp,dp2); } lint ans=0; rep(i,n+1){ add(ans,dp[i][k]*fact[i]); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:53:5: error: 'memset' was not declared in this scope 53 | memset(dp2,0,sizeof(dp2)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<vector> +++ |+#include <cstring> 4 | using namespace std;
s600727761
p03931
C++
#include <cstdio> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <iostream> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <bitset> #include <functional> using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back((a)) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<((x))<<endl #define fi first #define se second #define INF 2147483600 #define MOD 1000000007 int main(){ int n,k; cin>>n>>k; vector<int> vec(n); rep(i,n) scanf("%d", &vec[i]); vector<vector<long> > dp(n+1, vector<int>(256, 0)); // dp[i][j] i個使ってxorでjをつくる dp[0][0]=1; rep(d,n){ vector<vector<long> >nxt(n+1, vector<int>(256, 0)); nxt[0][0]=0; rep(i,d+1){ rep(j, 256) if(dp[i][j]>0){ nxt[i][j] += dp[i][j]; nxt[i+1][j^vec[d]] += dp[i][j]; } } dp = nxt; } long res=0; long fact=1; repl(i,1,n+1){ fact = fact*i%MOD; res += dp[i][k]*fact%MOD; } cout<<res%MOD<<endl; return 0; }
a.cc: In function 'int main()': a.cc:35:52: error: no matching function for call to 'std::vector<std::vector<long int> >::vector(int, std::vector<int>)' 35 | vector<vector<long> > dp(n+1, vector<int>(256, 0)); | ^ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/queue:63, from a.cc:9: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: a.cc:35:52: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 35 | vector<vector<long> > dp(n+1, vector<int>(256, 0)); | ^ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; allocator_type = std::allocator<std::vector<long int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<long int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<long int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<long int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; allocator_type = std::allocator<std::vector<long int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; allocator_type = std::allocator<std::vector<long int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<long int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<long int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; size_type = long unsigned int; value_type = std::vector<long int>; allocator_type = std::allocator<std::vector<long int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long int> >::value_type&' {aka 'const std::vector<long int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<long int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long int> >::allocator_type&' {aka 'const std::allocator<std::vector<long int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; allocator_type = std::allocator<std::vector<long int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided a.cc:39:54: error: no matching function for call to 'std::vector<std::vector<long int> >::vector(int, std::vector<int>)' 39 | vector<vector<long> >nxt(n+1, vector<int>(256, 0)); | ^ /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: a.cc:39:54: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 39 | vector<vector<long> >nxt(n+1, vector<int>(256, 0)); | ^ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; allocator_type = std::allocator<std::vector<long int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<long int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<long int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<long int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<long int>; _Alloc = std::allocator<std::vector<long int> >; allocator_type = std::allocator<std::vector<long int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::
s266409007
p03931
C++
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <climits> #define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define PB push_back #define MP make_pair #define FST first #define SND second #define SZ(a) (signed)((a).size()) #define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; const int MOD = 1000000007; #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; signed main(void) { ios::sync_with_stdio(false); cout.setf(ios::fixed, ios::floatfield); cout.precision(10); cin.tie(0); int n, k; cin >> n >> k; VI a(n); REP(i, n) { cin >> a[i]; } VVI data(256, VI(0)); REP(i, n) { VVI tdata = data; data[a[i]].PB(1); REP(j, 256) { REP(l, tdata[j].size()) { data[j ^ a[i]].PB(tdata[j][l] + 1); } } delete tdata; } VI factorial(101); factorial[1] = 1; FOR(i, 2, 101) { factorial[i] = (factorial[i - 1] * i) % MOD; } int ans = 0; REP(i, data[k].size()) { ans += factorial[data[k][i]]; ans %= MOD; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:72:16: error: type 'VVI' {aka 'class std::vector<std::vector<long long int> >'} argument given to 'delete', expected pointer 72 | delete tdata; | ^~~~~
s109137365
p03931
C++
#include<iostream> #include<vector> #include<cassert> using namespace std; #define int long long const int mod=1e9+7; int fact(int x){ int ret=1; for(int i=1; i<=x; i++){ (ret*=i)%=mod; } return ret; } int main(){ int n, k; cin>> n>> k; int a[n]; for(int i=0; i<n; i++) cin>> a[i]; assert(n<=20); int ans=0; for(int i=0; i<(1<<n); i++){ vector<int> id; for(int j=0; j<n; j++){ if((i>>j)&1){ id.push_back(j); } } vector<int> b; for(int j: id){ b.push_back(a[j]); } int s=0; for(int B: b){ s^=B; } if(s==k){ (ans+=fact(b.size()))%=mod; } } cout<< ans<< endl; return 0; }
cc1plus: error: '::main' must return 'int'
s261405843
p03931
C++
//aの各要素を{選ぶ, 選ばない}で, 数列bを作ってみる。 -> aは相異なるのでbは相異なる。 //-> bの順番(r!通り)によらず, xor(b)は同じ値. (つまり, 各長さrについて, この作り方でhoge[r]通り作れたとすれば… //答えはΣhoge[r] * r!になる。(選ぶ, 選ばない~でbを作る場合に必要な情報は [どこまで決めたか?, bの長さ, そこまでのxor]の3つ。これでDPすればよい) #include <iostream> #define int long long using namespace std; int mod = 1000000007; int n, k; int a[100]; int fact[101]; int dp[101][101][256]; //dp[id][len][xor] = count signed main() { int id, len, xor; cin >> n >> k; for (id = 0; id < n; id++) cin >> a[id]; fact[0] = 1; for (len = 1; len <= n; len++) { fact[len] = (fact[len - 1] * len) % mod; } dp[0][0][0] = 1; for (id = 0; id < n; id++) { for (len = 0; len <= id; len++) { for (xor = 0; xor < 256; xor++) { //使う dp[id + 1][len + 1][xor ^ a[id]] += dp[id][len][xor]; //使わない dp[id + 1][len][xor] += dp[id][len][xor]; } } } int ans = 0; for (len = 1; len <= n; len++) { ans += dp[n][len][k] * fact[len]; ans %= mod; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:22: error: expected unqualified-id before 'xor' token 16 | int id, len, xor; | ^~~ a.cc:25:30: error: expected primary-expression before 'xor' token 25 | for (xor = 0; xor < 256; xor++) { | ^~~ a.cc:25:34: error: expected primary-expression before '=' token 25 | for (xor = 0; xor < 256; xor++) { | ^ a.cc:25:39: error: expected primary-expression before 'xor' token 25 | for (xor = 0; xor < 256; xor++) { | ^~~ a.cc:25:43: error: expected primary-expression before '<' token 25 | for (xor = 0; xor < 256; xor++) { | ^ a.cc:25:50: error: expected primary-expression before 'xor' token 25 | for (xor = 0; xor < 256; xor++) { | ^~~ a.cc:25:55: error: expected primary-expression before ')' token 25 | for (xor = 0; xor < 256; xor++) { | ^ a.cc:27:53: error: expected primary-expression before 'xor' token 27 | dp[id + 1][len + 1][xor ^ a[id]] += dp[id][len][xor]; | ^~~ a.cc:27:57: error: expected primary-expression before '^' token 27 | dp[id + 1][len + 1][xor ^ a[id]] += dp[id][len][xor]; | ^ a.cc:27:81: error: expected primary-expression before 'xor' token 27 | dp[id + 1][len + 1][xor ^ a[id]] += dp[id][len][xor]; | ^~~ a.cc:27:84: error: expected primary-expression before ']' token 27 | dp[id + 1][len + 1][xor ^ a[id]] += dp[id][len][xor]; | ^ a.cc:29:49: error: expected primary-expression before 'xor' token 29 | dp[id + 1][len][xor] += dp[id][len][xor]; | ^~~ a.cc:29:52: error: expected primary-expression before ']' token 29 | dp[id + 1][len][xor] += dp[id][len][xor]; | ^ a.cc:29:69: error: expected primary-expression before 'xor' token 29 | dp[id + 1][len][xor] += dp[id][len][xor]; | ^~~ a.cc:29:72: error: expected primary-expression before ']' token 29 | dp[id + 1][len][xor] += dp[id][len][xor]; | ^
s565754379
p03932
C++
#include <iostream> #include <vector> #include <map> #include <tuple> using namespace std; map<int, int> mp; int f(vector<vector<int>> &A, int y1, int x1, int y2, int x2){ int X = (y1 * 200 + x1) * 200 + y2; if (mp.count(X)){ return mp[T]; } else { int tmp = A[y1][x1] + A[y2][x2]; if (y1 == y2 && x1 == x2){ tmp /= 2; } int ans = 0; if (y1 > 0 && y2 > 0){ ans = max(ans, f(A, y1 - 1, x1, y2 - 1, x2)); } if (y1 > 0 && x2 > 0){ ans = max(ans, f(A, y1 - 1, x1, y2, x2 - 1)); } if (x1 > 0 && y2 > 0){ ans = max(ans, f(A, y1, x1 - 1, y2 - 1, x2)); } if (x1 > 0 && x2 > 0){ ans = max(ans, f(A, y1, x1 - 1, y2, x2 - 1)); } ans += tmp; mp[X] = ans; return ans; } } int main(){ int H, W; cin >> H >> W; vector<vector<int>> A(H, vector<int>(W)); for (int i = 0; i < H; i++){ for (int j = 0; j < W; j++){ cin >> A[i][j]; } } cout << f(A, H - 1, W - 1, H - 1, W - 1) << endl; }
a.cc: In function 'int f(std::vector<std::vector<int> >&, int, int, int, int)': a.cc:10:27: error: 'T' was not declared in this scope 10 | return mp[T]; | ^
s784256584
p03932
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() const int mod=1000000007,MAX=405,INF=1<<30; int dp[MAX][MAX][MAX]; int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); int H,W;cin>>H>>W; vector<vector<ll>> S(H,vector<ll>(W)); for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ cin>>S[i][j]; } } for(int s=2;s<=H+W;s++){ for(int a=1;a<=H;a++){ if(1<=s-a&&s-a<=W){ for(int b=1;b<=H;b++){ if(1<=s-b&&s-b<=W){ if(a==b){ for(int bit=0;bit<4;bit++){ dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]); } }else{ for(int bit=0;bit<4;bit++){ dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]+S[b-1][s-b-1]); } } } } } } } cout<<dp[H+W][H][H]<<endl; }
a.cc: In function 'int main()': a.cc:31:48: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 31 | dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:31:48: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 31 | dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:31:48: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 31 | dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:35:48: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 35 | dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]+S[b-1][s-b-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:35:48: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 35 | dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]+S[b-1][s-b-1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:35:48: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 35 | dp[s][a][b]=max(dp[s][a][b],dp[s-1][a-bit/2][b-bit%2]+S[a-1][s-a-1]+S[b-1][s-b-1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s447147120
p03932
C++
//カタラン数を語らん!w #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include <random> #include<map> #include <iomanip> #include <time.h> #include <stdlib.h> #include <list> #include <typeinfo> #include <list> #include <set> #include <cassert> #include<fstream> #include <unordered_map> #include <cstdlib> #include <complex> #include <cctype> #include <bitset> using namespace std; typedef string::const_iterator State; #define Ma_PI 3.141592653589793 #define eps 1e-5 #define LONG_INF 2000000000000000000LL #define GOLD 1.61803398874989484820458 #define MAX_MOD 1000000007LL #define GYAKU 500000004LL #define MOD 998244353LL #define seg_size 262144*2 #define REP(a,b) for(long long a = 0;a < b;++a) #define int long long int dp[201][201][500]; int grid[201][201]; #undef int int main() { #define int long long int h, w; cin >> h >> w; int hoge = 0; REP(i, h) { REP(q, w) { cin >> grid[i][q]; hoge += grid[i][q]; } } dp[0][0][0] = 1; for (int i = 0; i < h + w-2; ++i) { for (int q = 0; q <= i; ++q) { for (int j = 0; j <= i; ++j) { int first_x = q; int first_y = i - q; int second_x = j; int second_y = i - j; REP(t, 2) { REP(p, 2) { int next_fx = first_x + t; int next_fy = first_y + 1 - t; int next_sx = second_x + p; int next_sy = second_y + 1 - p; if (next_fx >= h || next_sx >= h | next_fy >= w | next_sy >= w) { continue; } int winning = dp[q][j][i] + grid[next_fx][next_fy]; if (next_fx != next_sx || next_fy != next_sy) { winning += grid[next_sx][next_sy]; } dp[next_fx][next_sx][next_fx + next_fy] = max(dp[next_fx][next_sx][next_fx + next_fy], winning); } } } } } assert(hoge >= dp[i - 1][q - 1][h + w - 2]); cout << dp[h - 1][h - 1][h + w - 2] << endl; }
In file included from /usr/include/c++/14/cassert:44, from a.cc:27: a.cc: In function 'int main()': a.cc:87:27: error: 'i' was not declared in this scope 87 | assert(hoge >= dp[i - 1][q - 1][h + w - 2]); | ^ a.cc:87:34: error: 'q' was not declared in this scope 87 | assert(hoge >= dp[i - 1][q - 1][h + w - 2]); | ^
s734045653
p03932
C++
#include "iostream" #include "algorithm" #include "string" #include "vector" #include "cmath" #include "bitset" #include "queue" #include "functional" #include "map" #include "unordered_map" #include "set" #include "stack" #include "tuple" #define mod 1000000007 #define sp ' ' #define intmax 2147483647 #define llmax 92233720368547758070 #define nyan "(=^・ω・^=)" #define mkp make_pair #define mkt make_tuple #define P pair<ll, ll> #define iP pair<int,int> typedef long long ll; using namespace std; ll H,W,a[200][200],dp[400][200][200]={}; int main(){ cin>>H>>W; if(H==1||W==1){ int ans=0; for(int i=0;i!=H;++i) for(int j=0;j!=W;++j){ cin>>a[i][j]; ans+=a[i][j]; } cout<<ans<<endl; return 0; } for(int i=0;i!=H;++i) for(int j=0;j!=W;++j) cin>>a[i][j]; for(int i=1;i!=H+W-2;++i){ for(int j=max(0,i-H+1);j!=min(i,W-1);++j){ for(int k=j+1;k!=min(i+1,W);++k){ if(j) dp[i][j][k]=max({dp[i-1][j][k],dp[i-1][j-1][k],dp[i-1][j][k-1],dp[i-1][j-1][k-1]})+a[j][i-j]+a[k][i-k]; else dp[i][j][k]=max(dp[i-1][j][k],dp[i-1][j][k-1])+a[j][i-j]+a[k][i-k]; } } } cout<<a[0][0]+a[H-1][W-1]+dp[H+W-3][W-2][W-1]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:45:30: error: no matching function for call to 'max(int, ll)' 45 | for(int j=max(0,i-H+1);j!=min(i,W-1);++j){ | ~~~^~~~~~~~~ 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: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:45:30: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 45 | for(int j=max(0,i-H+1);j!=min(i,W-1);++j){ | ~~~^~~~~~~~~ /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, from a.cc:2: /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:45:30: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 45 | for(int j=max(0,i-H+1);j!=min(i,W-1);++j){ | ~~~^~~~~~~~~ a.cc:45:46: error: no matching function for call to 'min(int&, ll)' 45 | for(int j=max(0,i-H+1);j!=min(i,W-1);++j){ | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:45:46: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 45 | for(int j=max(0,i-H+1);j!=min(i,W-1);++j){ | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:45:46: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 45 | for(int j=max(0,i-H+1);j!=min(i,W-1);++j){ | ~~~^~~~~~~ a.cc:46:45: error: no matching function for call to 'min(int, ll&)' 46 | for(int k=j+1;k!=min(i+1,W);++k){ | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:46:45: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 46 | for(int k=j+1;k!=min(i+1,W);++k){ | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:46:45: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 46 | for(int k=j+1;k!=min(i+1,W);++k){ | ~~~^~~~~~~
s510905965
p03932
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int dp[200][200][200]; int a, b; int c[30][30]; int dx[2] = { -1,0 }, dy[2] = { 0,-1 }; int saiki(int d, int e, int f, int g) { if (dp[d][e][f] != -1)return dp[d][e][f]; for (int h = 0; h < 2; h++) { for (int i = 0; i < 2; i++) { int n = d + dx[h], m = e + dy[h]; if (n < 0 || m < 0)continue; int x = f + dx[i], y = g + dy[i]; if (x < 0 || y < 0)continue; int S = saiki(n, m, x, y); S += c[d][e]; S += c[f][g]; if (d == f&&e == g)S -= c[d][e]; dp[d][e][f] = max(dp[d][e][f], S); } } return dp[d][e][f]; } signed main() { memset(dp, -1, sizeof(dp)); cin >> a >> b; for (int d = 0; d < a; d++) { for (int e = 0; e < b; e++) { cin >> c[d][e]; } } dp[0][0][0] = c[0][0]; cout << saiki(a - 1, b - 1, a - 1, b - 1) << endl; }
a.cc: In function 'int main()': a.cc:27:9: error: 'memset' was not declared in this scope 27 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | using namespace std;
s889555882
p03932
C++
#include<iostream> #include<unordered_map> #include<cstdio> #include<string> #include<algorithm> #include<functional> #include<vector> #include<map> using namespace std; int dp[30][30][30][30]; int a, b; int c[30][30]; int dx[2] = { -1,0 }, dy[2] = { 0,-1 }; int saiki(int d, int e, int f, int g) { if (dp[d][e][f][g] != -1)return dp[d][e][f][g]; for (int h = 0; h < 2; h++) { for (int i = 0; i < 2; i++) { int n = d + dx[h], m = e + dy[h]; if (n < 0 || m < 0)continue; int x = f + dx[i], y = g + dy[i]; if (x < 0 || y < 0)continue; int S = saiki(n, m, x, y); S += c[d][e]; S += c[f][g]; if (d == f&&e == g)S -= c[d][e]; dp[d][e][f][g] = max(dp[d][e][f][g], S); } } return dp[d][e][f][g]; } signed main() { memset(dp, -1, sizeof(dp)); cin >> a >> b; for (int d = 0; d < a; d++) { for (int e = 0; e < b; e++) { cin >> c[d][e]; } } dp[0][0][0][0] = c[0][0]; cout << saiki(a - 1, b - 1, a - 1, b - 1) << endl; }
a.cc: In function 'int main()': a.cc:32:9: error: 'memset' was not declared in this scope 32 | memset(dp, -1, sizeof(dp)); | ^~~~~~ a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 8 | #include<map> +++ |+#include <cstring> 9 | using namespace std;
s848718239
p03932
C++
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <complex> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <bitset> #include <ctime> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <cassert> #include <cstddef> #include <iomanip> #include <numeric> #include <tuple> #include <sstream> #include <fstream> #include <chrono> #include <random> using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<LL>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using PII = pair<int, int>; using PDD = pair<double, double>; using PLL = pair<LL, LL>; using VPII = vector<PII>; template<typename T> using VT = vector<T>; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back const int INF = 1e9; const int MOD = INF + 7; const LL LLINF = 1e18; const int MAX_H = 210; const int MAX_W = 210; using State = pair<LL, PII>; // <score, (h, w)> int H, W; VVI a; int dp[MAX_H][MAX_W][MAX_H][MAX_W]; int main(void) { scanf("%d%d", &H, &W); a.resize(H, VI(W)); for_each(ALL(a), [](auto &v) { for_each(ALL(v), [](int &e){scanf("%d", &e);}); }); assert(H <= 30 && W <= 30); dp[0][0][0][0] = a[0][0]; REP(eh, H) REP(ew, W) REP(sh, H) REP(sw, W) { if (eh == 0 && ew == 0 && sh == 0 && sw == 0) continue; LL buf = 0; if (eh && sh) buf = max(buf, dp[eh - 1][ew][sh - 1][sw]); if (eh && sw) buf = max(buf, dp[eh - 1][ew][sh][sw - 1]); if (ew && sw) buf = max(buf, dp[eh][ew - 1][sh][sw - 1]); if (ew && sh) buf = max(buf, dp[eh][ew - 1][sh - 1][sw]); if (eh == sh && ew == sw) dp[eh][ew][sh][sw] = buf + a[sh][sw]; else dp[eh][ew][sh][sw] = buf + a[eh][ew] + a[sh][sw]; } cout << dp[H - 1][W - 1][H - 1][W - 1] << endl; }
a.cc: In function 'int main()': a.cc:82:32: error: no matching function for call to 'max(LL&, int&)' 82 | if (eh && sh) buf = max(buf, dp[eh - 1][ew][sh - 1][sw]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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: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:82:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 82 | if (eh && sh) buf = max(buf, dp[eh - 1][ew][sh - 1][sw]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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, from a.cc:5: /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:82:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 82 | if (eh && sh) buf = max(buf, dp[eh - 1][ew][sh - 1][sw]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:83:32: error: no matching function for call to 'max(LL&, int&)' 83 | if (eh && sw) buf = max(buf, dp[eh - 1][ew][sh][sw - 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:83:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 83 | if (eh && sw) buf = max(buf, dp[eh - 1][ew][sh][sw - 1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:83:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 83 | if (eh && sw) buf = max(buf, dp[eh - 1][ew][sh][sw - 1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:84:32: error: no matching function for call to 'max(LL&, int&)' 84 | if (ew && sw) buf = max(buf, dp[eh][ew - 1][sh][sw - 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:84:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 84 | if (ew && sw) buf = max(buf, dp[eh][ew - 1][sh][sw - 1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:84:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 84 | if (ew && sw) buf = max(buf, dp[eh][ew - 1][sh][sw - 1]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:85:32: error: no matching function for call to 'max(LL&, int&)' 85 | if (ew && sh) buf = max(buf, dp[eh][ew - 1][sh - 1][sw]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:85:32: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 85 | if (ew && sh) buf = max(buf, dp[eh][ew - 1][sh - 1][sw]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:85:32: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 85 | if (ew && sh) buf = max(buf, dp[eh][ew - 1][sh - 1][sw]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s026934353
p03932
C
#include<stdio.h> int map[200][200],dp[200][200][400]; int h,w; int search(int ax,int ay,int bx,int by){ int i,c,max=0; if(ax==0 && ay==0){ return map[0][0]+search(ax+1,ay,bx,by+1); }else if(ax==h-1 && ay==w-1){ return map[h-1][w-1]; }else{ if(dp[ax][ay][ax+ay]==0){ for(i=0;i<4;i++){ if(ax+(i%2)<h && ay+(1-i%2)<w && bx+i/2<h && by+(1-i/2)<w){ if((ax+(i%2)!=bx+(i/2)) || ax+ay==w+h-3){ c=map[ax][ay]+map[bx][by]+search(ax+(i%2),ay+(1-i%2),bx+i/2,by+(1-i/2)); if(c>max) max=c; } } } return dp[ax][ay][ax+ay]=max; }else{ return dp[ax][ay][ax+ay]; } } } int main(){ int i,j; scanf("%d %d",&h,&w); for(i=0;i<h;i++){ for(j=0;j<w;j++){ scanf("%d",&map[i][j]); for (int k = 0; k < h+w; k++) { dp[i][j][]=0; } } } printf("%d\n",search(0,0,0,0)); return 0; }
main.c: In function 'main': main.c:36:18: error: expected expression before ']' token 36 | dp[i][j][]=0; | ^
s031416417
p03932
C
#include<stdio.h> int map[200][200],dp[200][200][200][200]; int h,w,num; int search(int ax,int ay,int bx,int by){ int i; if(ax==0 && ay==0){ return search(ax+1,ay,bx,by+1); }else if(ax==h && ay==w){ return 0; }else{ if(dp[ax][ay][bx][by]==0){ for(i=0;i<4;i++){ if(ax+(i%2)<h && ay+(1-i%2)<w && bx+i/2<h && by+(1-i/2)<w){ if((ax+(i%2)!=bx+(i/2))) return dp[ax][ay][bx][by]=map[ax][ay]+map[bx][by]+search(ax+(i%2),ay+(1-i%2),bx+i/2,by+(1-i/2)); } } }else{ return dp[ax][ay][bx][by] } } } int main(){ int i,j; scanf("%d %d",&h,&w); for(i=0;i<h;i++){ for(j=0;j<w;j++){ scanf("%d",&map[i][j]); } } printf("%d\n",search(0,0,0,0)); return 0; }
main.c: In function 'search': main.c:20:50: error: expected ';' before '}' token 20 | return dp[ax][ay][bx][by] | ^ | ; 21 | } | ~
s229554406
p03932
C++
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <climits> #include <iostream> #include <algorithm> #include <set> #include <map> #include <queue> #include <vector> #include <sstream> #include <typeinfo> #include <fstream> #define DIV 1000000007 using namespace std; int dp[205][205][205][205]; int H, W; int a[205][205]; int main(){ cin >> H >> W; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ cin >> a[i][j]; } } for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ for(int k = 0; k < H; k++){ for(int l = 0; l < W; l++){ dp[i][j][k][l] = - INT_MAX; } } } } dp[0][0][0][0] = 0; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ for(int k = 0; k < H; k++){ for(int l = 0; l < W; l++){ if(i == k && j == l){ if(i != H - 1){ if(k != H - 1){ dp[i+1][j][k+1][l] = max(dp[i+1][j][k+1][l], dp[i][j][k][l] + a[i][j]); } if(l != W - 1){ dp[i+1][j][k][l+1] = max(dp[i+1][j][k][l+1], dp[i][j][k][l] + a[i][j]); } } if(j != W - 1){ if(k != H - 1){ dp[i][j+1][k+1][l] = max(dp[i][j+1][k+1][l], dp[i][j][k][l] + a[i][j]); } if(l != W - 1){ dp[i][j+1][k][l+1] = max(dp[i][j+1][k][l+1], dp[i][j][k][l] + a[i][j]); } } }else{ if(i != H - 1){ if(k != H - 1){ dp[i+1][j][k+1][l] = max(dp[i+1][j][k+1][l], dp[i][j][k][l] + a[i][j] + a[k][l]); } if(l != W - 1){ dp[i+1][j][k][l+1] = max(dp[i+1][j][k][l+1], dp[i][j][k][l] + a[i][j] + a[k][l]); } } if(j != W - 1){ if(k != H - 1){ dp[i][j+1][k+1][l] = max(dp[i][j+1][k+1][l], dp[i][j][k][l] + a[i][j] + a[k][l]); } if(l != W - 1){ dp[i][j+1][k][l+1] = max(dp[i][j+1][k][l+1], dp[i][j][k][l] + a[i][j] + a[k][l]); } } } } } } } cout << dp[H-1][W-1][H-1][W-1] + a[H-1][W-1] << endl; }
/tmp/ccBLflmI.o: in function `main': a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x7e): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0xac): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x145): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x154): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x17a): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x1db): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccBLflmI.o a.cc:(.text+0x1ed): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s224982332
p03932
C++
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <climits> #include <iostream> #include <algorithm> #include <set> #include <map> #include <queue> #include <vector> #include <sstream> #include <typeinfo> #include <fstream> #define DIV 1000000007 using namespace std; long long dp[205][205][205][205]; long long H, W; long long a[205][205]; int main(){ cin >> H >> W; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ cin >> a[i][j]; } } for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ for(int k = 0; k < H; k++){ for(int l = 0; l < W; l++){ dp[i][j][k][l] = - INT_MAX; } } } } dp[0][0][0][0] = 0; for(int i = 0; i < H; i++){ for(int j = 0; j < W; j++){ for(int k = 0; k < H; k++){ for(int l = 0; l < W; l++){ if(i == k && j == l){ if(i != H - 1){ if(k != H - 1){ dp[i+1][j][k+1][l] = max(dp[i+1][j][k+1][l], dp[i][j][k][l] + a[i][j]); } if(l != W - 1){ dp[i+1][j][k][l+1] = max(dp[i+1][j][k][l+1], dp[i][j][k][l] + a[i][j]); } } if(j != W - 1){ if(k != H - 1){ dp[i][j+1][k+1][l] = max(dp[i][j+1][k+1][l], dp[i][j][k][l] + a[i][j]); } if(l != W - 1){ dp[i][j+1][k][l+1] = max(dp[i][j+1][k][l+1], dp[i][j][k][l] + a[i][j]); } } }else{ if(i != H - 1){ if(k != H - 1){ dp[i+1][j][k+1][l] = max(dp[i+1][j][k+1][l], dp[i][j][k][l] + a[i][j] + a[k][l]); } if(l != W - 1){ dp[i+1][j][k][l+1] = max(dp[i+1][j][k][l+1], dp[i][j][k][l] + a[i][j] + a[k][l]); } } if(j != W - 1){ if(k != H - 1){ dp[i][j+1][k+1][l] = max(dp[i][j+1][k+1][l], dp[i][j][k][l] + a[i][j] + a[k][l]); } if(l != W - 1){ dp[i][j+1][k][l+1] = max(dp[i][j+1][k][l+1], dp[i][j][k][l] + a[i][j] + a[k][l]); } } } } } } } cout << dp[H-1][W-1][H-1][W-1] + a[H-1][W-1] << endl; }
/tmp/ccSy64Jf.o: in function `main': a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x7e): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0xa4): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0xba): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x178): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x192): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x1ac): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x215): relocation truncated to fit: R_X86_64_PC32 against symbol `H' defined in .bss section in /tmp/ccSy64Jf.o a.cc:(.text+0x22f): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s599751760
p03932
C++
#include <iostream> using namespace std; int main() { int H,W,a,T1,T2; cin >> H >> W; int array1[W]; int array2[W]; for(int i=0;i<W;i++){ cin >> array1[i]; T1=T1+array1[i]; } for(int i=0;i<W;i++){ cin >> array2[i]; T2=T2+array2[i]; } a=T1+T2-array1[i]-array2[W]; cout << a << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:20: error: 'i' was not declared in this scope 19 | a=T1+T2-array1[i]-array2[W]; | ^
s775491486
p03932
C
#include<stdio.h> int main(int argc, char const *argv[]) { int h,w,map[200][200],i,j,sum; scanf("%d %d",&h,&w); sum=0; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { scanf("%d",%map[i][j]); sum+=map[i][j]; } } printf("%d",sum); return 0; }
main.c: In function 'main': main.c:10:24: error: expected expression before '%' token 10 | scanf("%d",%map[i][j]); | ^
s946345288
p03932
C++
#include <iostream> #include <iomanip> #include <sstream> #include <vector> #include <string> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <functional> #include <iterator> #include <limits> #include <numeric> #include <utility> #include <type_traits> #include <cmath> #include <cassert> #include <cstdio> using namespace std; using namespace placeholders; using LL = long long; using ULL = unsigned long long; using VI = vector< int >; using VVI = vector< vector< int > >; using VS = vector< string >; using ISS = istringstream; using OSS = ostringstream; using PII = pair< int, int >; using VPII = vector< pair< int, int > >; template < typename T = int > using VT = vector< T >; template < typename T = int > using VVT = vector< vector< T > >; template < typename T = int > using LIM = numeric_limits< T >; template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; } template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; } template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; } template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); } #define NUMBERED( name, number ) NUMBERED2( name, number ) #define NUMBERED2( name, number ) name ## _ ## number #define REP1( n ) REP2( NUMBERED( REP_COUNTER, __LINE__ ), n ) #define REP2( i, n ) REP3( i, 0, n ) #define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i ) #define GET_REP( a, b, c, F, ... ) F #define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2, REP1 )( __VA_ARGS__ ) #define FOR( e, c ) for ( auto &&e : c ) #define ALL( c ) begin( c ), end( c ) #define AALL( a ) ( remove_all_extents< decltype( a ) >::type * )a, ( remove_all_extents< decltype( a ) >::type * )a + sizeof( a ) / sizeof( remove_all_extents< decltype( a ) >::type ) #define DRANGE( c, p ) begin( c ), begin( c ) + ( p ), end( c ) #define SZ( v ) ( (int)( v ).size() ) #define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() ) template < typename T > inline bool chmin( T &a, const T &b ){ if ( b < a ) { a = b; return true; } return false; } template < typename T > inline bool chmax( T &a, const T &b ){ if ( a < b ) { a = b; return true; } return false; } #define PB push_back #define EM emplace #define EB emplace_back #define BI back_inserter #define MP make_pair #define fst first #define snd second #define DUMP( x ) cerr << #x << " = " << ( x ) << endl // 最小費用流 O( F |E| log |V| ) class MinimumCostFlow { private: struct Edge { int to, cap, cost, rev; Edge( int t, int c, int d, int r ) : to( t ), cap( c ), cost( d ), rev( r ) {} }; const int V; vector< vector<Edge> > G; public: MinimumCostFlow( int v ) : V( v ), G( V ) {}; void connect( int from, int to, int cap, int cost ) { G[ from ].push_back( Edge( to, cap, cost, G[ to ].size() ) ); G[ to ].push_back( Edge( from, 0, -cost, G[ from ].size() - 1 ) ); return; } int solve( int s, int t, int f ) { int res = 0; vector<int> h( V, 0 ), prevv( V ), preve( V ); while ( 0 < f ) { vector<int> distance( V, INT_MAX ); distance[s] = 0; priority_queue< pair<int,int>, vector< pair<int,int> >, greater< pair<int,int> > > que; que.push( make_pair( 0, s ) ); while ( !que.empty() ) { int d = que.top().first; int v = que.top().second; que.pop(); if ( distance[v] < d ) { continue; } for ( int i = 0; i < (int)G[v].size(); ++i ) { Edge &e = G[v][i]; if ( 0 < e.cap && distance[v] + e.cost + h[v] - h[ e.to ] < distance[ e.to ] ) { distance[ e.to ] = distance[v] + e.cost + h[v] - h[ e.to ]; prevv[ e.to ] = v; preve[ e.to ] = i; que.push( make_pair( distance[ e.to ], e.to ) ); } } } if ( distance[t] == INT_MAX ) { return -1; } for ( int i = 0; i < V; ++i ) { h[i] += distance[i]; } int d = f; for ( int v = t; v != s; v = prevv[v] ) { d = min( d, G[ prevv[v] ][ preve[v] ].cap ); } f -= d; res += d * h[t]; for ( int v = t; v != s; v = prevv[v] ) { Edge &e = G[ prevv[v] ][ preve[v] ]; e.cap -= d; G[v][ e.rev ].cap += d; } } return res; } int solve2( const int s, const int t, int f ) { const int INF = INT_MAX / 2; int res = 0; while ( f > 0 ) { vector<int> dist( V, INF ); dist[s] = 0; vector<int> prevv( V ), preve( V ); bool update = true; while ( update ) { update = false; for ( int v = 0; v < V; v++ ) { if ( dist[v] == INF ) { continue; } for ( int i = 0; i < (int)G[v].size(); i++ ) { Edge &e = G[v][i]; if ( e.cap > 0 && dist[ e.to ] > dist[v] + e.cost ) { dist[ e.to ] = dist[v] + e.cost; prevv[ e.to ] = v; preve[ e.to ] = i; update = true; } } } } if ( dist[t] == INF ) { return -1; } int d = f; for ( int v = t; v != s; v = prevv[v] ) { d = min( d, G[ prevv[v] ][ preve[v] ].cap ); } f -= d; res += d * dist[t]; for ( int v = t; v != s; v = prevv[v] ) { Edge &e = G[ prevv[v] ][ preve[v] ]; e.cap -= d; G[v][ e.rev ].cap += d; } } return res; } }; // MinimumCostFlow( |V| ) // connect( from, to, cap, cost ) // solve( s, t, f ) : Primal-Dual O( F |E| log |V| ) // solve2( s, t, f ) : Bellman-Ford O( F |E| |V| ) int main() { cin.tie( 0 ); ios::sync_with_stdio( false ); cout << setprecision( 12 ) << fixed; int H, W; cin >> H >> W; VVI A( H, VI( W ) ); cin >> A; // [ 0, H * W ) := cell-in // [ H * W, 2 * H * W ) := cell-out const int SRC = 2 * H * W; const int SINK = SRC + 1; const auto in = [&]( const int i, const int j ){ return i * W + j; }; const auto out = [&]( const int i, const int j ){ return H * W + i * W + j; }; MinimumCostFlow mcf( SINK + 1 ); REP( i, H ) { REP( j, W ) { mcf.connect( in( i, j ), out( i, j ), 1, -A[i][j] ); } } mcf.connect( in( 0, 0 ), out( 0, 0 ), 1, 0 ); mcf.connect( in( H - 1, W - 1 ), out( H - 1, W - 1 ), 1, 0 ); REP( i, H ) { REP( j, W ) { if ( i + 1 < H ) { mcf.connect( out( i, j ), in( i + 1, j ), 1, 0 ); } if ( j + 1 < W ) { mcf.connect( out( i, j ), in( i, j + 1 ), 1, 0 ); } } } mcf.connect( SRC, in( 0, 0 ), 2, 0 ); mcf.connect( out( H - 1, W - 1 ), SINK, 2, 0 ); cout << -mcf.solve2( SRC, SINK, 2 ) << endl; return 0; }
a.cc: In member function 'int MinimumCostFlow::solve(int, int, int)': a.cc:105:50: error: 'INT_MAX' was not declared in this scope 105 | vector<int> distance( V, INT_MAX ); | ^~~~~~~ a.cc:23:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 22 | #include <cstdio> +++ |+#include <climits> 23 | a.cc: In member function 'int MinimumCostFlow::solve2(int, int, int)': a.cc:165:33: error: 'INT_MAX' was not declared in this scope 165 | const int INF = INT_MAX / 2; | ^~~~~~~ a.cc:165:33: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s114418082
p03933
C++
#include<bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b cout<<a; return 0; }
a.cc: In function 'int main()': a.cc:6:10: error: expected ';' before 'cout' 6 | cin>>a>>b | ^ | ; 7 | cout<<a; | ~~~~
s984181561
p03933
C++
#include <iostream> #include <math.h> #pragma GCC optimize(2) #pragma GCC optimize(3) using namespace std; typedef long long ll; const long double pi=3.1415926535897932; int n; ll kk; long double len[200005],a[200005]; inline ll read() { ll X=0,w=0; char ch=0; while(!isdigit(ch)) {w|=ch=='-';ch=getchar();} while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar(); return w?-X:X; } struct node{ ll num; long double S; }s[3333333334]; bool cmp(node a,node b) { return a.S<b.S; } int main() { //printf("%.12lf\n",sqrt(pi)); n=read();kk=read(); if(n==3) { printf("%.10lf\n",3*sqrt(3.0)/4); return 0; } int l=n/2; int c=n/3; len[1]=2*sin(pi/n); long double l2=len[1]*len[1]; a[1]=pi-2*pi/n; for(ll i=2;i<=l-1;i++) { a[i]=a[i-1]-pi/n; } for(ll i=2;i<=l;i++) { len[i]=sqrt(l2+len[i-1]*len[i-1]-2*len[1]*len[i-1]*cos(a[i-1])); } ll cnt,id=2; s[1].num=n; //printf("%.12lf %.12lf\n",len[1],len[2]); s[1].S=sqrt((len[1]+len[2]/2)*(len[2]*len[2]/4)*(len[1]-len[2]/2)); if(kk<=n) { printf("%.10Lf\n",s[1].S); return 0; } //printf("%.12lf\n",s[1]\.S); int k,tmp=0; for(int i=1;i<=c;++i) { for(int j=i;j<=(n-i)/2;++j) { k=n-i-j; if(i==1 && j==1) continue; if(i==j && j==k) { tmp=n/3; } else if(k==j || i==j || i==k) { tmp=n; } else { tmp=n*2; } k=min(k,n-k); s[id].num=tmp; long double half=(len[i]+len[j]+len[k])/2; s[id].S=sqrt(half*(half-len[i])*(half-len[j])*(half-len[k])); id++; //res+=tmp; } } id--; cnt=0; sort(s+1,s+id+1,cmp); /* for(ll i=1;i<=l;i++) { printf("%.8lf ",len[i]); } cout<<endl; for(ll i=1;i<=id;i++) { printf("%d: %.8lf ",s[i].num,s[i].S); } cout<<endl<<id<<endl; */ //cout<<res<<endl; for(int i=1;i<=id;++i) { cnt+=s[i].num; //cout<<cnt<<endl; if(cnt>=kk) { printf("%.10Lf",s[i].S); return 0; } } //printf("%d\n",cnt); //printf("%.12lf\n",sin(pi/n)); return 0; }
a.cc: In function 'int main()': a.cc:79:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 79 | sort(s+1,s+id+1,cmp); | ^~~~ | sqrt
s325846190
p03933
C++
#include <bits/stdc+.h> using namespace std; typedef long long ll; const long double pi=3.1415926535897932; ll n,k; long double len[5000005],a[5000005]; struct node{ ll num; long double S; }s[5000005]; bool cmp(node a,node b) { return a.S<b.S; } int main() { //printf("%.12lf\n",sqrt(pi)); cin>>n>>k; if(n==3) { printf("%.10lf\n",3*sqrt(3)/4); return 0; } ll l=n/2; ll c=n/3; len[1]=2*sin(pi/n); long double l2=len[1]*len[1]; a[1]=pi-2*pi/n; for(ll i=2;i<=l-1;i++) { a[i]=a[i-1]-pi/n; } for(ll i=2;i<=l;i++) { len[i]=sqrt(l2+len[i-1]*len[i-1]-2*len[1]*len[i-1]*cos(a[i-1])); } ll cnt,id=2; s[1].num=n; //printf("%.12lf %.12lf\n",len[1],len[2]); s[1].S=sqrt((len[1]+len[2]/2)*(len[2]*len[2]/4)*(len[1]-len[2]/2)); //printf("%.12lf\n",s[1].S); for(ll i=1;i<=c;i++) { for(ll j=i;j<=(n-i)/2;j++) { ll k=n-i-j; if(i==1 && j==1) continue; ll tmp; if(i==j && j==k) { tmp=n/3; } else if(k==j || i==j || i==k) { tmp=n; } else { tmp=n*2; } s[id].num=tmp; long double half=(len[i]+len[j]+len[min(k,n-k)])/2; s[id].S=sqrt(half*(half-len[i])*(half-len[j])*(half-len[min(k,n-k)])); id++; //cnt+=tmp; } } id--; cnt=0; sort(s+1,s+id+1,cmp); /* for(ll i=1;i<=l;i++) { printf("%.8lf ",len[i]); } cout<<endl; for(ll i=1;i<=id;i++) { printf("%d: %.8lf ",s[i].num,s[i].S); } cout<<endl<<id<<endl; */ for(ll i=1;i<=id;i++) { cnt+=s[i].num; //cout<<cnt<<endl; if(cnt>=k) { printf("%.10Lf",s[i].S); return 0; } } //printf("%d\n",cnt); //printf("%.12lf\n",sin(pi/n)); return 0; }
a.cc:1:10: fatal error: bits/stdc+.h: No such file or directory 1 | #include <bits/stdc+.h> | ^~~~~~~~~~~~~~ compilation terminated.
s023848652
p03933
C++
似懂非懂
a.cc:1:1: error: '\U00004f3c\U000061c2\U0000975e\U000061c2' does not name a type 1 | 似懂非懂 | ^~~~~~~~
s067327913
p03933
C++
#include <bits\stdc++.h> #define db long double #define S(A,B) 2*Sin[A]*Sin[B]*Sin[n-A-B] #define m (l+r)/2 using namespace std; db ms,ls=0,rs=1.299038105676658,pi=3.14159265358979323846; db Sin[200050]; long long n,k,i,p,q,l,r; int main() { //freopen("1.in","r",stdin); cin>>n>>k; cout<<setprecision(50); if (n%3==0&&k>1LL*n*(n-1)*(n-2)/6-n/3) {cout<<rs;return 0;} for (i=1;i<=n;i++) Sin[i]=sin(i*pi/n); k=k/n+(k%n>0); while (true) { db s=(ls+rs)/2; p=0,q=0,ms=0; for (i=1;i<=n/3;i++) { if (S(i,i)>s) break; l=i,r=(n-i)/2+1; while (r-l>1) if (S(i,m)<s) l=m;else r=m; if (ms<S(i,m)) ms=S(i,m),q=1+(m!=i&&m*2!=n-i); p+=2*(m-i)+1-(m*2==n-i); } if (k<=p&&p-q<k) break; if (p<k) ls=s;else rs=s; } cout<<ms; //fclose(stdin); }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s524474917
p03933
C++
#include <bits\stdc++.h> #define area(x,y) 2*Sin[x]*Sin[y]*Sin[n-x-y] #define db long double #define m (l+r>>1) #define pi (db) 3.14159265358979323846 #define N 300000 using namespace std; int L[N],R[N],tmp[N],n; long long k; db Sin[N],ans; int main() { cin>>n>>k; if (n%3==0&&k>1LL*n*(n-1)*(n-2)/6-n/3) {printf("1.29903810568\n");return 0;} for (int i=1;i<=n;i++) Sin[i]=sin(i*pi/n); for (int i=1;i<=n/3;i++) L[i]=i,R[i]=(n-i)/2; db ls=0,rs=1.39903810568; while (true) { db s=(ls+rs)/2; int p=0,q=0;ans=0; for (int i=1;i<=n/3;i++) { int l=L[i],r=R[i]+1; if (area(i,L[i])>s) break; while (r-l>1) if (area(i,m)<s) l=m;else r=m; tmp[i]=m; if (ans<area(i,m)-1e-7) q=0,ans=area(i,m); if (abs(ans-area(i,m)<1e-7)) {q+=n;if (m!=L[i]&&m*2!=n-i) q+=n;}; p+=n*(m-i+1)*2-n; if ((n-i)%2==0&&m==R[i]) p-=n; } if (p<k) for (int i=1;i<=n;i++) L[i]=max(L[i],tmp[i]),ls=s; if (k<=p-q) for (int i=1;i<=n;i++) R[i]=min(R[i],tmp[i]+1),rs=s; if (k<=p&&p-q<k) break; } cout<<setprecision(20); cout<<ans; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s879479009
p03933
C++
#include <bits/stdc++.h> using namespace std; #define len(x) (int((x).size())) #define append push_back #define pp make_pair #define ff(a, b) for (int a = 0; a < int(b); ++a) #define kk(n) ff(k, n) #define xx(n) ff(x, n) #define yy(n) ff(y, n) #define ii(n) ff(i, n) #define fff(a, b, c) for (int a = int(b); a < int(c); ++a) #define kkk(a, b) fff(k, a, b) #define xxx(a, b) fff(x, a, b) #define yyy(a, b) fff(y, a, b) #define iii(a, b) fff(i, a, b) #define bb begin() #define ee end() #define uu first #define vv second #define all(x) (x).bb, (x).ee #define ite(v) decltype((v).bb) #define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i) #define err(...) { fprintf(stderr, __VA_ARGS__); fflush(stderr); } #define zz(array, byte) memset(array, byte, sizeof(array)); using LL = long long; using DD = long double; using pii = pair<int, int>; const LL INFLL = 0x7f7f7f7f7f7f7f7fLL; const int INFint = 0x7f7f7f7f; //Works with memset(..). double M_PI = acos(-1); LL nbelow(double area, int N) { //Longest chord spans i steps along circumference. LL rr = 0; iii (1, N / 2 + 1) { int start = i; int finish = (N - i) / 2; if (start > finish) continue; double base = 2*sin((M_PI*i)/N); double height = 2*area/base; double x = height - cos((M_PI*i)/N); if (x < 1) { double angle = acos(x); double arc = M_PI - (M_PI*i)/N - angle; finish = min(finish, int(arc * N / (2*M_PI))); } if (finish < start) continue; //Don't count finish, count start only once. if (finish > start) { LL total = 2*(finish - start - 1) + 1; rr += total * LL(N); } if (finish == (N - i - finish)) { if (finish == i) { rr += N / 3; } else { rr += N; } } else { if (finish == start) rr += N; else rr += 2*N; } } //printf("For %g we have %d\n", area, int(rr)); return rr; } int main() { //ios_base::sync_with_stdio(false); cin.tie(NULL); //cout << '\n'; cout.precision(16); LL N, K; cin >> N >> K; double low = 0; double high = 10; while (high - low > 1e-12) { double mid = 0.5*(low + high); if (nbelow(mid, int(N)) >= K) high = mid; else low = mid; } cout << high << '\n'; return 0; }
In file included from /usr/include/c++/14/cmath:47, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114, from a.cc:1: a.cc:35:8: error: expected unqualified-id before numeric constant 35 | double M_PI = acos(-1); | ^~~~
s142369676
p03933
C++
#include <bits/stdc++.h> using namespace std; #define len(x) (int((x).size())) #define append push_back #define pp make_pair #define ff(a, b) for (int a = 0; a < int(b); ++a) #define kk(n) ff(k, n) #define xx(n) ff(x, n) #define yy(n) ff(y, n) #define ii(n) ff(i, n) #define fff(a, b, c) for (int a = int(b); a < int(c); ++a) #define kkk(a, b) fff(k, a, b) #define xxx(a, b) fff(x, a, b) #define yyy(a, b) fff(y, a, b) #define iii(a, b) fff(i, a, b) #define bb begin() #define ee end() #define uu first #define vv second #define all(x) (x).bb, (x).ee #define ite(v) decltype((v).bb) #define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i) #define err(...) { fprintf(stderr, __VA_ARGS__); fflush(stderr); } #define zz(array, byte) memset(array, byte, sizeof(array)); using LL = long long; using DD = long double; using pii = pair<int, int>; const LL INFLL = 0x7f7f7f7f7f7f7f7fLL; const int INFint = 0x7f7f7f7f; //Works with memset(..). const double M_PI = acos(-1); LL nbelow(double area, int N) { //Longest chord spans i steps along circumference. LL rr = 0; iii (1, N / 2 + 1) { int start = i; int finish = (N - i) / 2; double base = 2*sin((M_PI*i)/N); double height = 2*area/base; double x = height - cos((M_PI*i)/N); if (x < 1) { double angle = acos(x); double arc = M_PI - (M_PI*i)/N - angle; finish = min(finish, int(arc * N / (2*M_PI))); } if (finish < start) continue; //Don't count finish, count start only once. if (finish > start) { LL total = 2*(finish - start - 1) + 1; rr += total * LL(N); } if (finish == (N - i - finish)) { if (finish == i) { rr += N / 3; } else { rr += N; } } else rr += 2*N; } return rr; } int main() { //ios_base::sync_with_stdio(false); cin.tie(NULL); //cout << '\n'; cout.precision(16); LL N, K; cin >> N >> K; double low = 0; double high = 10; while (high - low > 1e-12) { double mid = 0.5*(low + high); if (nbelow(mid, int(N)) >= K) high = mid; else low = mid; } cout << high << '\n'; return 0; }
In file included from /usr/include/c++/14/cmath:47, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:114, from a.cc:1: a.cc:35:14: error: expected unqualified-id before numeric constant 35 | const double M_PI = acos(-1); | ^~~~
s710694309
p03933
C++
#include <iostream> #include <cstdio> #include <cmath> #include <complex> #include <vector> #include <algorithm> using namespace std; typedef complex<double> Point; int n, k; Point to_point(int i) { double pai = 3.14159265358979; return exp(complex<double>(0, 2 * pai * i / n)); } Point to_vector(int i, int j) { return to_point(j) - to_point(i); } double cross(Point &u, Point &v) { return imag(conj(u) * v); } //i < j < k double area(int i, int j, int k) { //面積を返す double ret = cross(to_vector(i, j), to_vector(i, k)); return ret / 2; } signed main() { int i, j, l; scanf("%d%d", &n, &k); if (n > 100) return 0; k = k - 1; static vector<double> vec; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { for (l = j + 1; l < n; l++) { vec.push_back(area(i, j, l)); } } } sort(vec.begin(), vec.end()); printf("%.14f\n", vec[k]); return 0; }
a.cc: In function 'double area(int, int, int)': a.cc:28:37: error: cannot bind non-const lvalue reference of type 'Point&' {aka 'std::complex<double>&'} to an rvalue of type 'Point' {aka 'std::complex<double>'} 28 | double ret = cross(to_vector(i, j), to_vector(i, k)); | ~~~~~~~~~^~~~~~ a.cc:22:21: note: initializing argument 1 of 'double cross(Point&, Point&)' 22 | double cross(Point &u, Point &v) { | ~~~~~~~^
s358597977
p03933
C++
#include <iostream> #include <cstdio> #include <cmath> #include <complex> #include <vector> #include <algorithm> using namespace std; typedef complex<double> Point; int n, k; Point to_point(int i) { double pai = 3.14159265358979; return exp(complex<double>(0, 2 * pai * i / n)); } Point to_vector(int i, int j) { return to_point(j) - to_point(i); } double cross(Point &u, Point &v) { return imag(conj(u) * v); } //i < j < k double area(int i, int j, int k) { //面積を返す double ret = cross(to_vector(i, j), to_vector(i, k)); return ret / 2; } signed main() { int i, j, k; cin >> n >> k; if (n > 100) return 0; k = k - 1; static vector<double> vec; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { for (k = j + 1; k < n; k++) { vec.push_back(area(i, j, k)); } } } sort(vec.begin(), vec.end()); printf("%.14f\n", vec[k]); return 0; }
a.cc: In function 'double area(int, int, int)': a.cc:28:37: error: cannot bind non-const lvalue reference of type 'Point&' {aka 'std::complex<double>&'} to an rvalue of type 'Point' {aka 'std::complex<double>'} 28 | double ret = cross(to_vector(i, j), to_vector(i, k)); | ~~~~~~~~~^~~~~~ a.cc:22:21: note: initializing argument 1 of 'double cross(Point&, Point&)' 22 | double cross(Point &u, Point &v) { | ~~~~~~~^
s419292946
p03935
C++
#include<cstdio> #include<cstring> typedef long long LL; const int N=2; const int M=1e6+50; const int mod=998244353; struct mat { LL c[N][N]; void clear(){memset(c,0,sizeof(c));} }a,t; mat operator * (mat a,mat b) { mat c;c.clear(); for(int k=0;k<N;++k) for(int i=0;i<N;++i) for(int j=0;j<N;++j) if(a.c[i][k]&&b.c[k][j]) c.c[i][j]=(c.c[i][j]+1ll*a.c[i][k]*b.c[k][j]%mod)%mod; return c; } int get(long long v) { a.c[0][0]=t.c[0][0]=t.c[0][1]=t.c[1][0]=1; while(v) { if(v&1)a=a*t; t=t*t;v>>=1; } return a.c[0][1]; } int n,Ans,x,f[M],inv[M]; LL m; int main(){ scanf("%d%lld",&n,&m); Ans=get(m+2*(n-1)); m%=mod;f[1]=g[1]=inv[1]=x=1; for(int i=2;i<=n;i++) { f[i]=(f[i-1]+f[i-2])%mod; inv[i]=(mod-1ll*(mod/i)*inv[mod%i]%mod)%mod; } for(int i=n+1;i<=2*n;i++) f[i]=(f[i-1]+f[i-2])%mod; for(int i=1;i<n;i++) { Ans=(Ans-1ll*x*f[2*n-i*2]%mod+mod)%mod; x=1ll*x*m%mod*inv[i]%mod; m++; } printf("%d\n",Ans); }
a.cc: In function 'int main()': a.cc:37:17: error: 'g' was not declared in this scope 37 | m%=mod;f[1]=g[1]=inv[1]=x=1; | ^
s602732944
p03935
C++
#include<cstdio> #include<cstring> typedef long long LL; const int N=2; const int M=1e6+50; const int mod=998244353; struct mat{ LL c[N][N]; void clear(){memset(c,0,sizeof(c));} }a,t; mat operator * (mat a,mat b){ mat c;c.clear(); for(int k=0;k<N;++k) for(int i=0;i<N;++i) for(int j=0;j<N;++j) if(a.c[i][k]&&b.c[k][j]) c.c[i][j]=(c.c[i][j]+1ll*a.c[i][k]*b.c[k][j]%mod)%mod; return c; } int get(long long v){ a.c[0][0]=t.c[0][0]=t.c[0][1]=t.c[1][0]=1; while(v){ if(v&1)a=a*t; t=t*t;v>>=1; } return a.c[0][1]; } int n,Ans,x,f[M],inv[M]; LL m; int main(){ scanf("%d%lld",&n,&m); Ans=get(m+2*(n-1)); m%=mod;f[1]=g[1]=inv[1]=x=1; for(int i=2;i<=n;i++){ f[i]=(f[i-1]+f[i-2])%mod; inv[i]=(mod-1ll*(mod/i)*inv[mod%i]%mod)%mod; } for(int i=n+1;i<=2*n;i++) f[i]=(f[i-1]+f[i-2])%mod; for(int i=1;i<n;i++){ Ans=(Ans-1ll*x*f[2*n-i*2]%mod+mod)%mod; x=1ll*x*m%mod*inv[i]%mod; m++; } printf("%d\n",Ans); }
a.cc: In function 'int main()': a.cc:33:21: error: 'g' was not declared in this scope 33 | m%=mod;f[1]=g[1]=inv[1]=x=1; | ^
s683779675
p03935
C++
#include ector #include <cassert> // ------------ Modulo Class ------------ // template<unsigned mod> class modulo { private: unsigned x; public: modulo() : x(0) {}; modulo(unsigned x_) : x(x_) {}; operator unsigned() { return x; } modulo operator==(const modulo& m) const { return x == m.x; } modulo operator!=(const modulo& m) const { return x != m.x; } modulo& operator+=(const modulo& m) { x = (x + m.x >= mod ? x + m.x - mod : x + m.x); return *this; } modulo& operator-=(const modulo& m) { x = (x < m.x ? x - m.x + mod : x - m.x); return *this; } modulo& operator*=(const modulo& m) { x = 1ULL * x * m.x % mod; return *this; } modulo operator+(const modulo& m) const { return modulo(*this) += m; } modulo operator-(const modulo& m) const { return modulo(*this) -= m; } modulo operator*(const modulo& m) const { return modulo(*this) *= m; } }; // ------------ Matrix Functions ------------ // typedef std::vector<modulo<998244353> > matrix_base; typedef std::vector<matrix_base> matrix; matrix mul(const matrix& a, const matrix& b) { assert(a[0].size() == b.size()); matrix ret(a.size(), matrix_base(b[0].size(), 0)); for (int i = 0; i < a.size(); i++) { for (int j = 0; j < b[0].size(); j++) { for (int k = 0; k < b.size(); k++) ret[i][j] += a[i][k] * b[k][j]; } } return ret; } matrix unit(int n) { matrix ret(n, matrix_base(n, 0)); for (int i = 0; i < n; i++) ret[i][i] = 1; return ret; } matrix power(const matrix& a, long long b) { assert(a.size() == a[0].size()); matrix f = a, ret = unit(a.size()); while (b) { if (b & 1) ret = mul(ret, f); f = mul(f, f); b >>= 1; } return ret; } // ------------ Modpower Algorithm ------------ // inline int modpow(int a, int b, int m) { int ret = 1; while (b) { if (b & 1) ret = 1LL * ret * a % m; a = 1LL * a * a % m; b >>= 1; } return ret; } // ------------ Number Theoretic Transform ------------ // inline static std::vector<int> FastModuloTransform(std::vector<int> v, int base, int root) { int n = v.size(); for (int i = 0, j = 1; j < n - 1; j++) { for (int k = n >> 1; k >(i ^= k); k >>= 1); if (i < j) std::swap(v[i], v[j]); } for (int b = 1; b <= n / 2; b *= 2) { int x = modpow(root, (base - 1) / (b << 1), base); for (int i = 0; i < n; i += (b << 1)) { int p = 1; for (int j = i; j < i + b; j++) { int t1 = v[j], t2 = 1LL * v[j + b] * p % base; v[j] = t1 + t2; v[j] = (v[j] < base ? v[j] : v[j] - base); v[j + b] = t1 - t2 + base; v[j + b] = (v[j + b] < base ? v[j + b] : v[j + b] - base); p = 1LL * p * x % base; } } } return v; } inline static std::vector<int> FastConvolutionMod(std::vector<int> v1, std::vector<int> v2, int mod, int tr) { int n = v1.size() * 2; // v1 and v2 must be the same size!! v1.resize(n); v2.resize(n); v1 = FastModuloTransform(v1, mod, tr); v2 = FastModuloTransform(v2, mod, tr); for (int i = 0; i < n; i++) v1[i] = 1LL * v1[i] * v2[i] % mod; v1 = FastModuloTransform(v1, mod, modpow(tr, mod - 2, mod)); int t = modpow(n, mod - 2, mod); for (int i = 0; i < n; i++) v1[i] = 1LL * v1[i] * t % mod; return v1; } // ------------ Lagrange Interpolation ------------ // std::vector<int> lagrange_interpolation(std::vector<int> &v, int m) { int n = v.size() - 1; std::vector<int> inv(n + 2); inv[1] = 1; for (int i = 2; i <= n; i++) inv[i] = 1LL * inv[m % i] * (m - m / i) % m; std::vector<int> ret(n + 1); int q = 1; for (int i = 1; i <= n; i++) q = 1LL * q * inv[i] % m; if (n % 2 == 1) q = (m - q) % m; for (int i = 0; i <= n; i++) { ret[i] = 1LL * v[i] * q % m; q = 1LL * q * (m - n + i) % m * inv[i + 1] % m; } return ret; } int lagrange_function(int x, std::vector<int> &v, int m) { int n = v.size() - 1; int mul = 1; for (int i = 0; i <= n; i++) mul = 1LL * mul * (x - i + m) % m; int ret = 0; for (int i = 0; i <= n; i++) ret = (ret + 1LL * v[i] * modpow(x - i + m, m - 2, m)) % m; return 1LL * ret * mul % m; } // ------------ Fibonacci Number ------------ // int nth_fibonacci(long long x) { matrix e(2, matrix_base(2)); e[0][0] = e[0][1] = e[1][0] = 1; matrix p(2, matrix_base(1)); p[0][0] = 1; p[1][0] = 0; return mul(power(e, x), p)[1][0]; } #include <iostream> using namespace std; const int mod = 998244353; int fact[1000009], inv[1000009], factinv[1000009]; int combination(int a, int b) { if (a < 0 || b < 0 || a < b) return 0; return 1LL * fact[a] * factinv[b] % mod * factinv[a - b] % mod; } int n; long long m; int main() { cin >> n >> m; n--; m--; if (n == 0) { cout << nth_fibonacci(m + 1) << endl; } else { fact[0] = 1; for (int i = 1; i < 2 * n; i++) fact[i] = 1LL * fact[i - 1] * i % mod; inv[1] = 1; for (int i = 2; i < 2 * n; i++) inv[i] = 1LL * inv[mod % i] * (mod - mod / i) % mod; factinv[0] = 1; for (int i = 1; i < 2 * n; i++) factinv[i] = 1LL * factinv[i - 1] * inv[i] % mod; vector<int> a(3 * n); a[0] = a[1] = 1; for (int i = 2; i < 3 * n; i++) a[i] = (a[i - 1] + a[i - 2]) % mod; int e = 1; while (e < n) e <<= 1; vector<int> b(e), bt(a.begin(), a.begin() + e); for (int i = 0; i < n; i++) b[i] = combination((n - 1) + i, i); vector<int> res = FastConvolutionMod(b, bt, mod, 3); if (m < n) { cout << res[m] << endl; } else { vector<int> diff(n); for (int i = 0; i < n; i++) diff[i] = (a[2 * n + i] - res[i] + mod) % mod; vector<int> poly = lagrange_interpolation(diff, mod); int f = nth_fibonacci(m + 2 * n + 1); int ret = lagrange_function(m % mod, poly, mod); cout << (f - ret + mod) % mod << endl; } } return 0; }
a.cc:1:10: error: #include expects "FILENAME" or <FILENAME> 1 | #include ector | ^~~~~ a.cc:24:14: error: 'vector' in namespace 'std' does not name a template type 24 | typedef std::vector<modulo<998244353> > matrix_base; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <cassert> +++ |+#include <vector> 3 | a.cc:25:14: error: 'vector' in namespace 'std' does not name a template type 25 | typedef std::vector<matrix_base> matrix; | ^~~~~~ a.cc:25:9: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 25 | typedef std::vector<matrix_base> matrix; | ^~~ a.cc:26:1: error: 'matrix' does not name a type 26 | matrix mul(const matrix& a, const matrix& b) { | ^~~~~~ a.cc:36:1: error: 'matrix' does not name a type 36 | matrix unit(int n) { | ^~~~~~ a.cc:41:1: error: 'matrix' does not name a type 41 | matrix power(const matrix& a, long long b) { | ^~~~~~ a.cc:64:20: error: 'vector' in namespace 'std' does not name a template type 64 | inline static std::vector<int> FastModuloTransform(std::vector<int> v, int base, int root) { | ^~~~~~ a.cc:64:15: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 64 | inline static std::vector<int> FastModuloTransform(std::vector<int> v, int base, int root) { | ^~~ a.cc:84:20: error: 'vector' in namespace 'std' does not name a template type 84 | inline static std::vector<int> FastConvolutionMod(std::vector<int> v1, std::vector<int> v2, int mod, int tr) { | ^~~~~~ a.cc:84:15: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 84 | inline static std::vector<int> FastConvolutionMod(std::vector<int> v1, std::vector<int> v2, int mod, int tr) { | ^~~ a.cc:98:6: error: 'vector' in namespace 'std' does not name a template type 98 | std::vector<int> lagrange_interpolation(std::vector<int> &v, int m) { | ^~~~~~ a.cc:98:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 98 | std::vector<int> lagrange_interpolation(std::vector<int> &v, int m) { | ^~~ a.cc:112:30: error: 'std::vector' has not been declared 112 | int lagrange_function(int x, std::vector<int> &v, int m) { | ^~~ a.cc:112:41: error: expected ',' or '...' before '<' token 112 | int lagrange_function(int x, std::vector<int> &v, int m) { | ^ a.cc: In function 'int lagrange_function(int, int)': a.cc:113:17: error: 'v' was not declared in this scope 113 | int n = v.size() - 1; | ^ a.cc:115:65: error: 'm' was not declared in this scope 115 | for (int i = 0; i <= n; i++) mul = 1LL * mul * (x - i + m) % m; | ^ a.cc:117:79: error: 'm' was not declared in this scope 117 | for (int i = 0; i <= n; i++) ret = (ret + 1LL * v[i] * modpow(x - i + m, m - 2, m)) % m; | ^ a.cc:118:34: error: 'm' was not declared in this scope 118 | return 1LL * ret * mul % m; | ^ a.cc: In function 'int nth_fibonacci(long long int)': a.cc:123:9: error: 'matrix' was not declared in this scope 123 | matrix e(2, matrix_base(2)); | ^~~~~~ a.cc:124:9: error: 'e' was not declared in this scope 124 | e[0][0] = e[0][1] = e[1][0] = 1; | ^ a.cc:125:15: error: expected ';' before 'p' 125 | matrix p(2, matrix_base(1)); | ^~ | ; a.cc:126:9: error: 'p' was not declared in this scope 126 | p[0][0] = 1; p[1][0] = 0; | ^ a.cc:127:20: error: 'power' was not declared in this scope 127 | return mul(power(e, x), p)[1][0]; | ^~~~~ a.cc:127:16: error: 'mul' was not declared in this scope 127 | return mul(power(e, x), p)[1][0]; | ^~~ a.cc: In function 'int main()': a.cc:151:17: error: 'vector' was not declared in this scope 151 | vector<int> a(3 * n); a[0] = a[1] = 1; | ^~~~~~ a.cc:151:17: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' a.cc:151:24: error: expected primary-expression before 'int' 151 | vector<int> a(3 * n); a[0] = a[1] = 1; | ^~~ a.cc:151:39: error: 'a' was not declared in this scope 151 | vector<int> a(3 * n); a[0] = a[1] = 1; | ^ a.cc:154:24: error: expected primary-expression before 'int' 154 | vector<int> b(e), bt(a.begin(), a.begin() + e); | ^~~ a.cc:155:45: error: 'b' was not declared in this scope 155 | for (int i = 0; i < n; i++) b[i] = combination((n - 1) + i, i); | ^ a.cc:156:24: error: expected primary-expression before 'int' 156 | vector<int> res = FastConvolutionMod(b, bt, mod, 3); | ^~~ a.cc:158:33: error: 'res' was not declared in this scope 158 | cout << res[m] << endl; | ^~~ a.cc:161:32: error: expected primary-expression before 'int' 161 | vector<int> diff(n); | ^~~ a.cc:162:53: error: 'diff' was not declared in this scope 162 | for (int i = 0; i < n; i++) diff[i] = (a[2 * n + i] - res[i] + mod) % mod; | ^~~~ a.cc:162:79: error: 'res' was not declared in this scope 162 | for (int i = 0; i < n; i++) diff[i] = (a[2 * n + i] - res[i] + mod) % mod; | ^~~ a.cc:163:32: error: expected primary-expression before 'int' 163 | vector<int> poly = lagrange_interpolation(diff, mod); | ^~~ a.cc:165:62: error: 'poly' was not declared in this scope 165 | int ret = lagrange_function(m % mod, poly, mod); | ^~~~
s468332118
p03935
C++
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- ll N,M; ll mo=998244353; //2^23*7*17+1 ll D[202020]; ll modpow(ll a, ll n) { ll r=1; while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1; return r; } ll comb(int P_,int Q_) { if(P_<0 || Q_<0 || Q_>P_) return 0; ll ret=1; Q_=min(Q_,P_-Q_); for(int i=1;i<=Q_;i++) ret=ret*(P_+1-i)%mo*modpow(i,mo-2)%mo; return ret; } ll fib(ll k,ll a1=1,ll a2=1) { ll R[2][2]={{1,0},{0,1}}; ll A[2][2]={{1,1},{1,0}}; k--; while(k) { ll S[2][2], T[2][2]; if(k%2) { S[0][0]=(A[0][0]*R[0][0]+A[0][1]*R[1][0])%mo; S[0][1]=(A[0][0]*R[0][1]+A[0][1]*R[1][1])%mo; S[1][0]=(A[1][0]*R[0][0]+A[1][1]*R[1][0])%mo; S[1][1]=(A[1][0]*R[0][1]+A[1][1]*R[1][1])%mo; swap(S,R); } ll T[2][2]; T[0][0]=(A[0][0]*A[0][0]+A[0][1]*A[1][0])%mo; T[0][1]=(A[0][0]*A[0][1]+A[0][1]*A[1][1])%mo; T[1][0]=(A[1][0]*A[0][0]+A[1][1]*A[1][0])%mo; T[1][1]=(A[1][0]*A[0][1]+A[1][1]*A[1][1])%mo; swap(T,A); k>>=1; } return (R[1][0]+R[1][1])%mo; } void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>M; M+=2*(N-1); ll F=fib(M); if(N>3000) return; for(i=1;i<N;i++) { M=(M+mo-2)%mo; F=(F+mo-comb(M+i,i-1))%mo; } cout<<F<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }
a.cc: In function 'll fib(ll, ll, ll)': a.cc:47:20: error: redeclaration of 'll T [2][2]' 47 | ll T[2][2]; | ^ a.cc:39:29: note: 'll T [2][2]' previously declared here 39 | ll S[2][2], T[2][2]; | ^
s703808239
p03935
C++
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key typedef long long ll; typedef pair<ll,ll> ii; typedef vector<int> vi; typedef long double ld; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; typedef set<int>::iterator sit; typedef map<int,int>::iterator mit; typedef vector<int>::iterator vit; const ll MOD = 998244353; ll dp[3001][3001]; const int DIM = 7; struct Matrix { ll a[DIM][DIM]; int *operator [] (int r) { return a[r]; }; Matrix(int x = 0) { memset(a, 0, sizeof a); if (x) { for(int i = 0; i < DIM; i++) a[i][i] = x; } } } const I(1); Matrix operator * (Matrix A, Matrix B) { const ll mod2 = ll(MOD) * MOD; Matrix C; for(int i = 0; i < DIM; i++) { for(int j = 0; j < DIM; j++) { ll w = 0; for(int k = 0; k < DIM; k++) { w += (ll(A[i][k]) * B[k][j])%MOD; w%=MOD; } C[i][j] = w % MOD; } } return C; } Matrix ori(0); Matrix ans(0); void out(Matrix A) { for(int i = 0; i < 6; i++) { for(int j = 0; j < 6; j++) { cerr<<A.a[i][j]<<' '; } cerr<<'\n'; } cerr<<'\n'; } void solve(ll b) { vector<int> digits; while(b) { digits.pb(b%2); b>>=1; } digits.pop_back(); reverse(digits.begin(),digits.end()); ans = ori; //out(ans); for(int i = 0; i < digits.size(); i++) { ans = (ans*ans); if(digits[i]==1) { ans=(ans*ori); } //out(ans); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, m; cin>>n>>m; if(m==1) { cout<<1<<'\n'; return 0; } if(n>3) { dp[1][1] = 1; dp[1][2] = 1; for(int i = 3; i <= m; i++) { dp[1][i]=(dp[1][i-1]+dp[1][i-2])%MOD; } for(int i = 2; i <= n; i++) { for(int j = 1; j <= m; j++) { dp[i][j] = (dp[i][j-1]+dp[i-1][j])%MOD; } } cout<<dp[n][m]<<'\n'; } else { ori[0][0]=ori[0][1]=ori[1][1]=ori[1][3]=ori[2][1]=ori[3][3]=ori[3][4]=ori[4][3]=ori[5][4]=1; ans=ori; solve(m); //out(ans); ll answer = 0; if(n==1) { answer=(ans[5][1]+ans[5][3]+ans[5][4])%MOD; } if(n==2) { answer=(ans[2][1]+ans[2][3]+ans[2][4])%MOD; } if(n==3) { answer=(ans[0][1]+ans[0][3]+ans[0][4])%MOD; } cout<<answer<<'\n'; } }
a.cc: In member function 'int* Matrix::operator[](int)': a.cc:31:40: error: cannot convert 'll*' {aka 'long long int*'} to 'int*' in return 31 | int *operator [] (int r) { return a[r]; }; | ~~~^ | | | ll* {aka long long int*}
s095722559
p03936
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define fi first #define se second typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} #define DBG 0 int N=50; int K=250; int A[50][50]; int cnt; int q(int y1,int x1,int y2,int x2){ if((y2-y1)*(x2-x1)==0)return 0; if(DBG){ int res=0; for(int y=y1;y<y2;y++)for(int x=x1;x<x2;x++)res+=A[y][x]; return res; } else{ cout<<"? "<<y1<<" "<<x1<<" "<<y2-1<<" "<<x2-1<<endl; int p;cin>>p; return p; } } vector<int>lis[2555]; int dfs(int y1,int x1,int y2,int x2,int p){ if(y1==y2)return 0; if(x1==x2)return 0; if((y2-y1)*(x2-x1)==p){ for(int y=y1;y<y2;y++)for(int x=x1;x<x2;x++)A[y][x]=1; return 0; } if(p==0)return 0; int y3=(y1+y2)/2; int x3=(x1+x2)/2; int pl=q(y1,x1,y2,x3); int pu=q(y1,x1,y3,x2); int p11,p12,p21,p22; int cnt=2; if(pl==0){ p11=p21=0; p12=pu; p22=p-pu; } else if(pl==p){ p12=p22=0; p11=pu; p21=p-pu; } else if(pu==0){ p11=p12=0; p21=pl; p22=p-pl; } else if(pu==p){ p21=p22=0; p11=pl; p12=p-pl; } else{ p11=q(y1,x1,y3,x3); p12=pu-p11; p21=pl-p11; p22=p-p11-p12-p21; cnt++; } cnt+=dfs(y1,x1,y3,x3,p11); cnt+=dfs(y1,x3,y3,x2,p12); cnt+=dfs(y3,x1,y2,x3,p21); cnt+=dfs(y3,x3,y2,x2,p22); lis[(y2-y1)*(x2-x1)].pb(cnt); return cnt; } const int B=8 signed main(){ if(DBG){ vector<pint>v; rep(i,N)rep(j,N)v.pb({i,j}); srand((unsigned)time(NULL)); random_shuffle(all(v)); for(int i=0;i<K;i++){ A[v[i].fi][v[i].se]=1; } int sum=0; for(int i=0;i<N/B;i++){ for(int j=0;j<N/B;j++){ int y=(i+1)*B; int x=(j+1)*B; if(i+1==N/B)y=N; if(j+1==N/B)x=N; int p=q(i*B,j*B,y,x); sum++; sum+=dfs(i*B,j*B,y,x,p); } } int cnt=0; rep(i,N)rep(j,N)cnt+=A[i][j]; cout<<cnt<<endl; cout<<sum<<endl; cout<<dfs(0,0,N,N,K)<<endl; } else{ int tmp; cin>>tmp;cin>>tmp;cin>>tmp; int mod;cin>>mod; for(int i=0;i<(N+B-1)/B;i++){ for(int j=0;j<(N+B-1)/B;j++){ int p=q(i*B,j*B,min(N,(i+1)*B),min(N,(j+1)*B)); dfs(i*B,j*B,min(N,(i+1)*B),min(N,(j+1)*B),p); } } int p=1; int res=0; rep(i,N)rep(j,N){ res=(res+p*A[i][j])%mod; p=p*2%mod; } cout<<"! "<<res<<endl; } return 0; }
a.cc:102:1: error: expected ',' or ';' before 'signed' 102 | signed main(){ | ^~~~~~
s525961475
p03936
C
#include<stdio.h> int H, W, N, K; int ans_map[50][50]; void check4s(int h, int w, int num) { int p; int c = 0; printf("? %d %d %d %d\n", h, w, h, w); fflush(stdout); scanf("%d", &p); ans_map[h][w] = p; c += p; if(c == num) return; printf("? %d %d %d %d\n", h, w+1, h, w+1); fflush(stdout); scanf("%d", &p); ans_map[h][w+1] = p; c += p; if(c == num) return; printf("? %d %d %d %d\n", h+1, w, h+1, w); fflush(stdout); scanf("%d", &p); ans_map[h+1][w] = p; c += p; if(c == num) return; ans_map[h+1][w+1] = 1; } void check4h(int h, int w, int num) { int i; int p; int c = 0; for(i=0;i<3;i++) { printf("? %d %d %d %d\n", h, w+i, h, w+i); fflush(stdout); scanf("%d", &p); ans_map[h][w+i] = p; c += p; if(c == num) return; } ans_map[h][w+3] = 1; } void check4v(int h, int w, int num) { int i; int p; int c = 0; for(i=0;i<3;i++) { printf("? %d %d %d %d\n", h+i, w, h+i, w); fflush(stdout); scanf("%d", &p); ans_map[h+i][w] = p; c += p; if(c == num) return; } ans_map[h+3][w] = 1; } void check25(int h, int w, int num) { int i, j; int p; int c = 0; for(i=0;i<2;i++) { for(j=0;j<2;j++) { printf("? %d %d %d %d\n", h+i*2, w+j*2, h+i*2+1, w+j*2+1); fflush(stdout); scanf("%d", &p); if(p > 0) { c += p; check4s(h+i*2, w+j*2, p); if(c == num) return; } } } printf("? %d %d %d %d\n", h+4, w, h+4, w+3); fflush(stdout); scanf("%d", &p); if(p > 0) { c += p; check4h(h+4, w, p); if(c == num) return; } printf("? %d %d %d %d\n", h, w+4, h+3, w+4); fflush(stdout); scanf("%d", &p); if(p > 0) { c += p; check4v(h, w+4, p); if(c == num) return; } ans_map[h+4][w+4] = 1; } int main() { int i, j; int p; int c = 0; long ans = 0; scanf("%d %d %d %d", &H, &W, &N, &K); /* for(i=0;i<10;i++) { for(j=0;j<10;j++) { if(c == N) break; printf("? %d %d %d %d\n", i*5, j*5, i*5+4, j*5+4); fflush(stdout); scanf("%d", &p); if(p > 0) { c += p; check25(i*5, j*5, p); } } }*/ for(i=0;i<H;i++) { for(j=0;j<W;j++) { printf("? %d %d %d %d\n", i, j, i, j); scanf("%d", &p); ans_map[i][j] = p; } } for(i=0;i<H;i++) { for(j=0;j<W;j++) { if(ans_map[i][j]) ans += pow; pow *= 2; ans %= K; pow %= K; } } printf("! %ld\n", ans); return 0; }
main.c: In function 'main': main.c:137:50: error: 'pow' undeclared (first use in this function) 137 | if(ans_map[i][j]) ans += pow; | ^~~ main.c:137:50: note: each undeclared identifier is reported only once for each function it appears in
s946425999
p03936
C++
#include<cstdio> #include<cstring> #include<cstdlib> #include<vector> using namespace std; int main(void){ int h, w, n, k; int ans = 0; int a[2501]; a[0] = 1; int x; int n=0; scanf("%d %d %d %d", &h, &w, &n, &k); for (int i = 1; i < 2501; i++){ a[i] = a[i - 1] * 2; a[i] = a[i] % k; } for (int i = 0; i < 50; i++){ for (int j = 0; j < 50; j++){ printf("?%d %d %d %d", i, j, i, j); scanf("%d", &x); if (x == 1){ ans = ans + a[(50 * i) + j]; ans = ans%k; n++; if (n == 250){ printf("!%d\n", ans); return 0; } } } } printf("!%d\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:12:13: error: redeclaration of 'int n' 12 | int n=0; | ^ a.cc:7:19: note: 'int n' previously declared here 7 | int h, w, n, k; | ^
s808515748
p03937
C++
#define rep(i,n) for (int i = 0; i < (int)(n); i++) #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); short h,w,ans = 0; cin >> h >> w; char ai; rep(i,h) { cin >> ai; rep(j,w) if (ai[j] == '#') ans ++; } if (ans == h+w-1) cout << "Possible\n"; else cout << "Impossible\n"; }
a.cc: In function 'int main()': a.cc:15:24: error: invalid types 'char[int]' for array subscript 15 | rep(j,w) if (ai[j] == '#') ans ++; | ^
s722385143
p03937
C++
#include <bits/stdc++.h> using namespace std; int main(){ int H,W; cin>>H>>W; vector<vector<char>>A(H+2,vector<char>(W+2,".")); for(int i=1;i<H+1;i++){ string S; cin>>S; for(int j=1;j<W+1;j++)A[i][j]=S.at(j-1); } int a=0,b=0; for(int i=0;i<H+W;i++){ if(A[a+1][b]=='#'&&A[a][b+1]=='#'){cout<<"Impossible"<<endl;return 0;} else if(A[a+1][b]=='#'){a++;continue;} else if(A[a][b+1]=='#'){b++;continue;} cout<<"Impossible"<<endl; } cout<<"possible"<<endl; }
a.cc: In function 'int main()': a.cc:5:49: error: no matching function for call to 'std::vector<char>::vector(int, const char [2])' 5 | vector<vector<char>>A(H+2,vector<char>(W+2,".")); | ^ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; size_type = long unsigned int; value_type = char; allocator_type = std::allocator<char>]' (near match) 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:7: note: conversion of argument 2 would be ill-formed: a.cc:5:46: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive] 5 | vector<vector<char>>A(H+2,vector<char>(W+2,".")); | ^~~ | | | const char* /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = char; _Alloc = std::allocator<char>]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: a.cc:5:49: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'const char*') 5 | vector<vector<char>>A(H+2,vector<char>(W+2,".")); | ^ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<char>' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>; std::__type_identity_t<_Alloc> = std::allocator<char>]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<char>&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>; std::__type_identity_t<_Alloc> = std::allocator<char>]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<char>&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; size_type = long unsigned int; allocator_type = std::allocator<char>]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'const char [2]' to 'const std::vector<char>::allocator_type&' {aka 'const std::allocator<char>&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = char; _Alloc = std::allocator<char>; allocator_type = std::allocator<char>]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = char; _Alloc = std::allocator<char>]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s033002210
p03937
C++
#include <iostream> #include<vector> using namespace std; int main(void){ int h,w; cin >> h >> w; vector<string> s(h); for(int i = 0;i < n;i++){ cin >> s[i]; } int stone = 0; for(int i = 0;i < h;i++){ for(int j = 0;j < w;j++){ if(s[i][j] == '#')stone++; } } cout << ((h + w - 1 == stone) ? "Yes" : "No") << endl; }
a.cc: In function 'int main()': a.cc:8:22: error: 'n' was not declared in this scope 8 | for(int i = 0;i < n;i++){ | ^
s642882391
p03937
C++
#include <bits/stdc++.h> #include <vector> #include <algorithm> #include <iostream> #include <cmath> #include <map> using namespace std; int main() { int H, W, N; cin >> H >> W; N=0; vector<vector<string>> A(H,vector<string>(W)); for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { cin >> A[i][j]; if (A[i][j]=='#') { N=N+1; } } } if (N==H+W-1) { cout << "Possible" << endl; } else { cout << "Impossible" << endl; } }
a.cc: In function 'int main()': a.cc:17:18: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} and 'char') 17 | if (A[i][j]=='#') { In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:17:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:17:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:17:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 17 | if (A[i][j]=='#') { | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 17 | if (A[i][j]=='#') { | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | if (A[i][j]=='#') { | ^~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std:
s053214296
p03937
C++
#include <bits/stdc++.h> #include <vector> #include <algorithm> #include <iostream> #include <cmath> #include <map> using namespace std; int main() { int H, W, N; cin >> H >> W; N=0; vector<vector<string>> A(H,vector<sting>(W)); for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { cin >> A[i][j]; if (A[i][j]=='#') { N=N+1; } } } if (N==H+W-1) { cout << "Possible" << endl; } else { cout << "Impossible" << endl; } }
a.cc: In function 'int main()': a.cc:13:37: error: 'sting' was not declared in this scope 13 | vector<vector<string>> A(H,vector<sting>(W)); | ^~~~~ a.cc:13:42: error: template argument 1 is invalid 13 | vector<vector<string>> A(H,vector<sting>(W)); | ^ a.cc:13:42: error: template argument 2 is invalid a.cc:17:18: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} and 'char') 17 | if (A[i][j]=='#') { In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:17:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:17:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:17:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 17 | if (A[i][j]=='#') { | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 17 | if (A[i][j]=='#') { | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | if (A[i][j]=='#') { | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:17:20: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | if (A[i][j]=='#') { | ^~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __l
s515442920
p03937
C++
#include <bits/stdc++.h> using namespace std; int h, w; vector<string> a(8); int nextX[] = { 0, 1}; int nextY[] = {1, 0}; vector<vector<int>> arrived(8, vector<int>(8, 0)); bool range_check(int y, int x) { if (y < 0 || x < 0 || y >= h || x >= w) { return false; } return true; } bool dfs(int y, int x) { // cout << y << " " << x << endl; if (!range_check(y, x)) { return false; } if (arrived[y][x]) { return false; } arrived[y][x] = 1; if (y == h - 1 && x == w - 1) { return true; } bool flg = false; for (int i = 0; i < 2; i++) { int ny = y + nextY[i], nx = x + nextX[i]; if (range_check(ny, nx)) { if (a[ny][nx] == '#') { if (arrived[ny][nx] == 0) { flg = dfs(ny, nx); } } } } return flg; } int main() { cin >> h >> w; for (int i = 0; i < h; i++) { cin >> a[i]; } if(dfs(0,0)){ for (int i = 0;i<h;i++){ for (int j = 0; j < w;j++){ if(s[i][j]=='#'){ if(arrived[i][j]==0){ cout << "Impossible" << endl; return 0; } } } } cout << "Possible" << endl; }else{ cout << "Impossible" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:50:12: error: 's' was not declared in this scope 50 | if(s[i][j]=='#'){ | ^
s906158980
p03937
C++
#include <bits/stdc++.h> typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)n; ++i) const int MOD = 1000000007; using namespace std; void solve(void) { int h, w; cin >> h >> w; vector<string> a(h); rep(i, h) cin >> a[i]; vector<vector<int>> f(h, vector<int>(w, -1)); int sy = 0, sx = 0; f[sy][sx] = 0; queue<pair<int, int>> q; q.push({sy, sx}); while (!q.empty()) { auto s = q.front(); q.pop(); int y = s.first, x = s.second; if (x + 1 >= w) continue; if (a[y][x + 1] == '#' && f[y][x + 1] == -1) f[y][x + 1] = f[y][x] + 1, q.push({y, x + 1}); if (y + 1 >= h) continue; if (a[y + 1][x] == '#' && f[y + 1][x] == -1) f[y + 1][x] = f[y][x] + 1, q.push({y + 1, x}); } map<int, int> mp; rep(i, h) rep(j, w) if (s[i][j] == '.') mp[f[i][j]]++; if (f[h - 1][w - 1] == -1) cout << "Impossible" << endl; else { bool flag = true; for (auto i : mp) { if (i.first == -1) continue; if (i.second > 1) flag = false; } if (flag) cout << "Possible" << endl; else cout << "Impossible" << endl; } } int main(void) { solve(); }
a.cc: In function 'void solve()': a.cc:33:29: error: 's' was not declared in this scope 33 | rep(i, h) rep(j, w) if (s[i][j] == '.') mp[f[i][j]]++; | ^
s739194349
p03937
C++
#include <bits/stdc++.h> #include <unistd.h> #define fi first #define se second #define rep(i,n) for (ll i = 0; i < (n); ++i) #define rep1(i,n) for (ll i = 1; i <= (n); ++i) #define rrep(i,n) for (ll i = (n)-1; i >=0; --i) #define ALL(a) a.begin(),a.end() #define pb push_back #define dame { puts("-1"); return 0;} #define show(x) cerr<<#x<<" = "<<x<<endl; using namespace std; using ll = long long; using ld = long double; using pl = pair<ll, ll>; ll LINF = 1000000000000000000; typedef vector<ll> vl; typedef vector<pl> vp; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } struct edge{ll to, cost;}; struct dijkstra{ ll V; vector<vector<edge> > G; vector<ll> d; dijkstra(ll n){ init(n); } void init(ll n){ V = n; G.resize(V); d.resize(V); rep(i,V){ d[i] = LINF; } } void add_edge(ll s, ll t, ll cost){ edge e; e.to = t, e.cost = cost; G[s].push_back(e); } void run(ll s){ rep(i,V){ d[i] = LINF; } d[s] = 0; priority_queue<pl,vector<pl>, greater<pl> > que; que.push(pl(0,s)); while(!que.empty()){ pl p = que.top(); que.pop(); ll v = p.second; if(d[v]<p.first) continue; for(auto e : G[v]){ if(d[e.to]>d[v]+e.cost){ d[e.to] = d[v]+e.cost; que.push(pl(d[e.to],e.to)); } } } } }; // auto mod int // https://youtu.be/L8grWxBlIZ4?t=9858 // https://youtu.be/ERZuLAxZffQ?t=4807 : optimize // https://youtu.be/8uowVvQ_-Mo?t=1329 : division const ll mod = 1000000007; struct mint { ll x; // typedef long long ll; mint(ll x=0):x((x%mod+mod)%mod){} mint operator-() const { return mint(-x);} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;} mint operator+(const mint a) const { return mint(*this) += a;} mint operator-(const mint a) const { return mint(*this) -= a;} mint operator*(const mint a) const { return mint(*this) *= a;} mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2);} mint& operator/=(const mint a) { return *this *= a.inv();} mint operator/(const mint a) const { return mint(*this) /= a;} }; istream& operator>>(istream& is, const mint& a) { return is >> a.x;} ostream& operator<<(ostream& os, const mint& a) { return os << a.x;} // combination mod prime // https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619 struct combination { vector<mint> fact, ifact; combination(int n):fact(n+1),ifact(n+1) { assert(n < mod); fact[0] = 1; for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i; ifact[n] = fact[n].inv(); for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i; } mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n]*ifact[k]*ifact[n-k]; } } c(200005); // Sieve of Eratosthenes // https://youtu.be/UTVg7wzMWQc?t=2774 struct Sieve { int n; vector<int> f, primes; Sieve(int n=1):n(n), f(n+1) { f[0] = f[1] = -1; for (ll i = 2; i <= n; ++i) { if (f[i]) continue; primes.push_back(i); f[i] = i; for (ll j = i*i; j <= n; j += i) { if (!f[j]) f[j] = i; } } } bool isPrime(int x) { return f[x] == x;} vector<int> factorList(int x) { vector<int> res; while (x != 1) { res.push_back(f[x]); x /= f[x]; } return res; } vector<pl> factor(int x) { vector<int> fl = factorList(x); if (fl.size() == 0) return {}; vector<pl> res(1, pl(fl[0], 0)); for (int p : fl) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } vector<pair<ll,int>> factor(ll x) { vector<pair<ll,int>> res; for (int p : primes) { int y = 0; while (x%p == 0) x /= p, ++y; if (y != 0) res.emplace_back(p,y); } if (x != 1) res.emplace_back(x,1); return res; } }; using data = pair<ll, vector<ll> >; vector<ll> v; void fff(ll n){ if(n==0) return; if(n==4){ cout << 3 << endl; cout << 1 << endl; return ; } rep(i, 10000){ if(i*(i+1)/2>=n){ cout << i << endl; n -= (i); break; } } fff(n); } int main() { ll h, w; cin >> h >> w; vector<vector<char> > a(h, vector<char>(w, '')); ll s = 0; rep(i, h){ rep(j, w){ cin >> a[i][j]; if(a[i][j]=='#') s++; } } if(s!=h+w-1){ cout << "Impossible" << endl; return 0; } string ans = "Possible"; cout << ans << endl; return 0; }
a.cc:198:46: error: empty character constant 198 | vector<vector<char> > a(h, vector<char>(w, '')); | ^~
s850247500
p03937
C++
#include <iostream> // cout, endl, cin #include <string> // string, to_string, stoi #include <cstring> #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 #include <cmath> #include <numeric> #include <float.h> #include <math.h> #include <sstream> #include <iterator> using namespace std; using Graph = vector<vector<int>>; // repマクロの定義 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) // allマクロの定義 #define all(v) v.begin(), v.end() // 大きい順 #define rall(v) v.rbegin(), v.rend() #define vi vector<int> #define vl vector<ll> const long long INF = 1LL << 60; typedef long long ll; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } int ctoi(char c) { switch (c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; default: return 0; } } bool is_prime(const unsigned n){ switch(n){ case 0: // fall-through case 1: return false; case 2: // fall-through case 3: return true; } // n > 3 が保証された if(n % 2 == 0 || n % 3 == 0) return false; // n は 2 と 3 のいずれの倍数でもないことが保証された // これより n は (6の倍数)-1 か (6の倍数)+1 である // 6の倍数前後の数を使って試し割りをする for(unsigned i = 5; i * i <= n; i += 6) { if(n % i == 0) return false; // (6の倍数)-1 if(n % (i+2) == 0) return false; // (6の倍数)+1 } return true; } map<ll,ll> mp; ll primeFactorization(ll a){ //素因数分解を出力するプログラム ll i,sq; if(a%2==0){ //偶数の場合 if(!mp.count(2)){ mp[2] = 1; } else{ mp[2] +=1; } return primeFactorization(a/2); //2で割った値で再帰 } sq = sqrt(a); for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合 if(a%i==0){ if(!mp.count(i)){ mp[i] = 1; } else{ mp[i] += 1; } return primeFactorization(a/i); //割れた値で再帰 } } //偶数でも3以上√a以下の奇数の場合でも割り切れない場合 if(a!=1){ //aが1でないなら、a自身は素数 if(!mp.count(a)) mp[a] = 1; else{ mp[a] += 1; } } return 0; } ll kaizyou(ll n){ if(n == 1){ return 1; } else{ return (n * kaizyou(n-1)) % 1000000007; } } /////////////*ここからatcoderの問題*///////////// int main(){ int H,W; cin >> H >> W; vector<vector<char>> a(H,vector<char> W); int cnt = 0; rep(i,H){ rep(j,W){ cin >> a[i][j]; if(a[i][j] == '#') cnt++; } } if(cnt != W + H - 1){ cout << "Impossible" << endl; } else{ cout << "Possible" << endl; } }
a.cc: In function 'int main()': a.cc:143:39: error: expected primary-expression before 'W' 143 | vector<vector<char>> a(H,vector<char> W); | ^
s532197287
p03937
C++
#include <iostream> // cout, endl, cin #include <string> // string, to_string, stoi #include <cstring> #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 #include <cmath> #include <numeric> #include <float.h> #include <math.h> #include <sstream> #include <iterator> using namespace std; using Graph = vector<vector<int>>; // repマクロの定義 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) // allマクロの定義 #define all(v) v.begin(), v.end() // 大きい順 #define rall(v) v.rbegin(), v.rend() #define vi vector<int> #define vl vector<ll> const long long INF = 1LL << 60; typedef long long ll; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } int ctoi(char c) { switch (c) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; default: return 0; } } bool is_prime(const unsigned n){ switch(n){ case 0: // fall-through case 1: return false; case 2: // fall-through case 3: return true; } // n > 3 が保証された if(n % 2 == 0 || n % 3 == 0) return false; // n は 2 と 3 のいずれの倍数でもないことが保証された // これより n は (6の倍数)-1 か (6の倍数)+1 である // 6の倍数前後の数を使って試し割りをする for(unsigned i = 5; i * i <= n; i += 6) { if(n % i == 0) return false; // (6の倍数)-1 if(n % (i+2) == 0) return false; // (6の倍数)+1 } return true; } map<ll,ll> mp; ll primeFactorization(ll a){ //素因数分解を出力するプログラム ll i,sq; if(a%2==0){ //偶数の場合 if(!mp.count(2)){ mp[2] = 1; } else{ mp[2] +=1; } return primeFactorization(a/2); //2で割った値で再帰 } sq = sqrt(a); for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合 if(a%i==0){ if(!mp.count(i)){ mp[i] = 1; } else{ mp[i] += 1; } return primeFactorization(a/i); //割れた値で再帰 } } //偶数でも3以上√a以下の奇数の場合でも割り切れない場合 if(a!=1){ //aが1でないなら、a自身は素数 if(!mp.count(a)) mp[a] = 1; else{ mp[a] += 1; } } return 0; } ll kaizyou(ll n){ if(n == 1){ return 1; } else{ return (n * kaizyou(n-1)) % 1000000007; } } /////////////*ここからatcoderの問題*///////////// int main(){ int H,W; cin >> H >> W; vector<vector<char>> a(H,vector<char> W); int cnt = 0; rep(i,H){ rep(j,W){ cin >> a[i][j]; if(a[i][j] == '#') cnt++; } } if(cnt != W + H - 1){ cout << "Impossible" << endl; } else{ cout << "Possible" << endl; }
a.cc: In function 'int main()': a.cc:143:39: error: expected primary-expression before 'W' 143 | vector<vector<char>> a(H,vector<char> W); | ^ a.cc:156:2: error: expected '}' at end of input 156 | } | ^ a.cc:141:11: note: to match this '{' 141 | int main(){ | ^
s025681112
p03937
C++
#include<iostream> #include<stdio.h> #include<vector> #include<algorithm> #include<set> #include<string> #include<map> #include<string.h> #include<complex> #include<math.h> #include<queue> #include <functional> #include<time.h> #include <stack> #include<iomanip> using namespace std; #define rep(i,a,n) for(int i=(a);i<(n);i++) #define ll long long #define llint long long int #define reverse(v) reverse(v.begin(), v.end()); #define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl; #define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl; #define hei(a) vector<a> #define whei(a) vector<vector<a>> #define UF UnionFind #define Pint pair<int,int> #define keta(a) fixed << setprecision(a) constexpr auto INF = 1000000000000000000; constexpr auto mod = 1000000007; //辞書順はnext_permutation( begin( v ), end( v ) );やで! struct edge { int to, cost; }; ll gcd(ll a, ll b) { if (a < b)swap(a, b); if (b == 0)return a; return gcd(b, a % b); } long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } // mod. m での a の逆元 a^{-1} を計算するよ! long long modinv(long long a, long long m) { long long b = m, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= m; if (u < 0) u += m; return u; } //aCbをmod.mで割った余りを求める ll int c(ll int a, ll int b, ll int m) { ll int ans = 1; for (ll int i = 0; i < b; i++) { ans *= a - i; ans %= m; } for (ll int i = 1; i <= b; i++) { ans *= modinv(i, m); ans %= m; } return ans; } struct UnionFind { vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化 for (int i = 0; i < N; i++) par[i] = i; } int size(int a) { return par[root(a)]; } int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根} if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { // xとyの木を併合 int rx = root(x); //xの根をrx int ry = root(y); //yの根をry if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける } bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す int rx = root(x); int ry = root(y); return rx == ry; } }; int main() { int h, w; cin >> h >> w; bool ans = false; int g = 0; whei(char) a(h, hei(char)(w)); rep(i, 0, h)rep(j, 0, w) { cin >> a[i][j]; if (a[i][j] == '#')g++; } int dx[2] = { 1.0 }; int dy[2] = { 0,1 }; whei(bool) d(h, hei(bool)(w, false)); d[0][0] = true; queue<Pint> que; que.push(Pint(0, 0)); while (!que.empty()) { Pint P = que.front(); que.pop(); rep(i, 0, 2) { int Nx = P.first + dx[i]; int Ny = P.second + dy[i]; if (Nx >= h || Ny >= w)continue; if (a[Nx][Ny] == '.' || d[Nx][Ny] == true)continue; que.push(Pint(Nx, Ny)); d[Nx][Ny] = true; } } if (d[h-1][w-1]&&g==h+w-1)cout << "Possible" << endl; else cout << "Impossible" << endl; return 0; }
a.cc: In function 'int main()': a.cc:115:23: error: narrowing conversion of '1.0e+0' from 'double' to 'int' [-Wnarrowing] 115 | int dx[2] = { 1.0 }; | ^~~
s275238487
p03937
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll h,w,tmp; cin>>h>>w; vector<vector<char>> a(h,vector<char(w)); bool flag = true; for(int i=0; i<h; i++) { for(int j=0; j<w; j++) { cin>>a[i][j]; } } for(int i=0; i<h; i++) { for(int j=0; j<w; j++) { if(a[i][j] == '#') { if(tmp > j) flag = false; else tmp = j; } } } if(flag) cout<<"Possible"<<endl; else cout<<"Impossible"<<endl; }
a.cc: In function 'int main()': a.cc:8:43: error: the value of 'w' is not usable in a constant expression 8 | vector<vector<char>> a(h,vector<char(w)); | ^ a.cc:6:10: note: 'll w' is not const 6 | ll h,w,tmp; | ^ a.cc:8:43: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' 8 | vector<vector<char>> a(h,vector<char(w)); | ^ a.cc:8:43: note: expected a type, got '(char)w' a.cc:8:43: error: template argument 2 is invalid
s698348863
p03937
C++
#include<iostream> using namespace std; int main(){ int h,w;cin>>h>>w; char c[h][w]; for(int i=0;i<h;i++)cin>>c[i][j]; cout<<"Possible"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:33: error: 'j' was not declared in this scope 6 | for(int i=0;i<h;i++)cin>>c[i][j]; | ^
s553737595
p03937
C++
#include <bits/stdc++.h> #ifdef __DEBUG__ #define DBG(X) cout << #X << " = " << (X) << endl; #define SAY(X) cout << (X) << endl; #else #define DBG(X) #define SAY(X) #endif using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; int dx[]={1, 0, -1, 0, 1,-1, 1,-1}; int dy[]={0, 1, 0, -1, 1, 1,-1,-1}; const int INT_INF = (int)(2e9); const ll LL_INF = (ll)(2e18); inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); }; template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; } template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; } template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; } template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; } template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; } template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; } int H,W; vector<string> A; void input(){ fast_io(); cin >> H >> W; for (int i = 0; i < H; i++) { string s; cin >> s; A.push_back(s); } } vector<vector<bool>> visited; void dfs(int i, int j){ visited[i][j] = true; int cnt = 0; for (int k = 0; k < 2; k++) { int x = i+dx[k]; int y = j+dy[k]; if(x<0 || x>=H) continue; if(y<0 || y>=W) continue; if(A[x][y]=='#') cnt++; } if(cnt!=1) return; for (int k = 0; k < 2; k++) { int x = i+dx[k]; int y = j+dy[k]; if(x<0 || x>=H) continue; if(y<0 || y>=W) continue; if(A[x][y]=='#') dfs(x,y); } } bool solve(){ visited.assign(H,vector<bool>(W,false)); dfs(0,0); for (int) i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if(A[i][j]=='#' && !visited[i][j]) return false; if(A[i][j]!='#' && visited[i][j]) return false; } } return visited[H-1][W-1]; } bool WAsolve(){ for (int i = 0; i < H-1; i++) { for (int j = 0; j < W-1; j++) { if(A[i][j]=='#'){ if(A[i+1][j]=='#' && A[i][j+1]=='#') return false; else if(A[i+1][j]=='.' && A[i][j+1]=='.') return false; } } } return true; } int main() { input(); cout << (solve()?"Possible":"Impossible") << endl; return 0; }
a.cc: In function 'bool solve()': a.cc:70:13: error: expected unqualified-id before ')' token 70 | for (int) i = 0; i < H; i++) | ^ a.cc:70:13: error: expected ';' before ')' token 70 | for (int) i = 0; i < H; i++) | ^ | ; a.cc:70:13: error: expected primary-expression before ')' token a.cc:70:13: error: expected ';' before ')' token 70 | for (int) i = 0; i < H; i++) | ^ | ; a.cc:70:15: error: 'i' was not declared in this scope 70 | for (int) i = 0; i < H; i++) | ^ a.cc:70:22: error: 'i' was not declared in this scope 70 | for (int) i = 0; i < H; i++) | ^
s357036234
p03937
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; typedef pair<int, int> P; ll Mod = 1000000007; int H,W; char field[9][9]; int dx[2] = {0,1}; int dy[2] = {1,0}; bool DFS(int x,int y) { if (x == H - 1 && y == W - 1) { return true; } else { bool res = false; for (int i = 0; i < 2; i++) { int fx = x + dx[i]; int fy = y + dy[i]; if (field[fx][fy] == '#' && fx <= H - 1 && fy <= W - 1) { if (DFS(fx,fy)) { field[fx][fy] = '.' res = true; } } } return res; } } int main() { cin >> H >> W; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> field[i][j]; } } bool ans = true; if (!DFS(0,0)) { ans = false; } for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (field[i][j] == '#') { ans = false; } } } if (ans) { cout << "Possible" << endl; } else { cout << "Impossible" << endl; } return 0; }
a.cc: In function 'bool DFS(int, int)': a.cc:22:30: error: expected ';' before 'res' 22 | field[fx][fy] = '.' | ^ | ; 23 | res = true; | ~~~
s043643061
p03937
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; typedef pair<int, int> P; ll Mod = 1000000007; int H,W; char field[9][9]; int dx[2] = {0,1}; int dy[2] = {1,0}; bool DFS(int x,int y) { if (x == H - 1 && y == W - 1) { return true; } else { bool res = false; for (int i = 0; i < 2; i++) { int fx = x + dx[i]; int fy = y + dy[i]; if (field[fx][fy] == '#' && fx <= H - 1 && fy <= W - 1) { if (DFS(fx,fy)) { field[fx][fy] = '.' res = true; } } } return res; } } int main() { cin >> H >> W; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> field[i][j]; } } bool ans = true; if (!DFS(0,0)) { ans = false; } for (int i = 0; i < H; i++) { for (int j - 0; j < W; j++) { if (field[i][j] == '#') { ans = false; } } } if (ans) { cout << "Possible" << endl; } else { cout << "Impossible" << endl; } return 0; }
a.cc: In function 'bool DFS(int, int)': a.cc:22:30: error: expected ';' before 'res' 22 | field[fx][fy] = '.' | ^ | ; 23 | res = true; | ~~~ a.cc: In function 'int main()': a.cc:43:15: error: expected ';' before '-' token 43 | for (int j - 0; j < W; j++) { | ^~ | ; a.cc:43:26: error: expected ')' before ';' token 43 | for (int j - 0; j < W; j++) { | ~ ^ | ) a.cc:43:28: error: 'j' was not declared in this scope 43 | for (int j - 0; j < W; j++) { | ^
s080179834
p03937
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; typedef pair<int, int> P; ll Mod = 1000000007; int H,W; char field[9][9]; int dx[2] = {0,1}; int dy[2] = {1,0}; bool DFS(int x,int y) { if (x == H - 1 && y == W - 1) { return true; } else { bool res = false; for (int i = 0; i < 2; i++) { int fx = x + dx[i]; int fy = y + dy[i]; if (field[fx][fy] == '.') { if (DFS(fx,fy)) { res = true; } } } return res; } } int main() { cin >> H >> W; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { cin >> A[i][j]; } } if (DFS(0,0)) { cout << "Possible" << endl; } else { cout << "Impossible" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:34:14: error: 'A' was not declared in this scope 34 | cin >> A[i][j]; | ^
s046347200
p03937
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; typedef pair<int, int> P; ll Mod = 1000000007; int H,W; char field[9][9]; int dx[2] = {0,1}; int dy[2] = {1,0}; bool DFS(int x,int y) { if (x == H - 1 && y == W - 1) { return true; } else { bool res = false; for (int i = 0; i < 2; i++) { int fx = x + dx[i]; int fy = y + dy[i]; if (field[fx][fy] == '.') { if (DFS(fx,fy)) { res = true; } } } return res; } } int main() { cin >> H >> W; for (int i = 0; i < H; i++) { for (int j - 0; j < W; j++) { cin >> A[i][j]; } } if (DFS(0,0)) { cout << "Possible" << endl; } else { cout << "Impossible" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:33:15: error: expected ';' before '-' token 33 | for (int j - 0; j < W; j++) { | ^~ | ; a.cc:33:26: error: expected ')' before ';' token 33 | for (int j - 0; j < W; j++) { | ~ ^ | ) a.cc:33:28: error: 'j' was not declared in this scope 33 | for (int j - 0; j < W; j++) { | ^
s534355190
p03937
C++
#include <bits/stdc++.h> using namespace std; int main(){ int counter1,counter2; counter1=0; counter2=0; int b; int c=0; int k=0; int H,W; cin>>H>>W; int counter=W+H+10; int count=-1; char a[H][W]; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ cin>>a[i][j];}} for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if(a[i][j]=='#'){ counter1++; counter2=0; b=1; } else {counter2++; if(b==0){ c++;}}} if(W-(counter2+c)==1){ counter=counter2; count=c; counter1=0; counter2=0; b=0; c=0; continue;} else if(counter=<counter2){ goto aaa;} else if(count>=c){ goto aaa;} else{ counter=counter2; count=c; counter1=0; counter2=0; b=0; c=0; }} if(1>0){ cout<<"Possible"<<endl;} else{ aaa: cout<<"Impossible"<<endl;}}
a.cc: In function 'int main()': a.cc:35:17: error: expected primary-expression before '<' token 35 | else if(counter=<counter2){ | ^
s084740730
p03937
C++
#include <bits/stdc++.h> using namespace std; int main(){ int counter1,counter2; counter1=0; counter2=0; int answer=0; int i=0; int H,W; cin>>H>>W; int counter=W+H+10; int count=-1; char a[H][W]; for(int i=0;i<W;i++){ for(int j=0;j<H;j++){ cin>>a[i][j];}} for(int i=0;i<W;i++){ for(int j=0;j<H;j++){ if(a[j]=='#'){ counter1++; counter2=0;} else {counter2++;}} if(counter<counter2){ i++;} if(count>counter1){ i++;} counter=counter2; count=counter1; counter1=0; counter2=0;} if(i>0){ cout<<"Impossible"<<endl;} else cout<<"possible"<<endl;}
a.cc: In function 'int main()': a.cc:18:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 18 | if(a[j]=='#'){ | ~~~~^~~~~
s288983532
p03937
C++
H, W = map(int, input().split()) cnt = 0 for i in range(H): A = input() cnt += A.count('#') if (H + W - 1 == cnt): print('Possible') else: print('Impossible')
a.cc:6:30: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 6 | if (H + W - 1 == cnt): print('Possible') | ^~~~~~~~~~ a.cc:7:13: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes 7 | else: print('Impossible') | ^~~~~~~~~~~~ a.cc:1:1: error: 'H' does not name a type 1 | H, W = map(int, input().split()) | ^
s356935559
p03937
C++
#include <iostream> using namespace std; int H, W; void dfs(int x, int y, string *A) { if (x < W && y < H) { if (A[x + 1][y] == '#' && A[x][y + 1] == '#') return; else if (A[x + 1][y] == '#') dfs(x + 1, y, A); else if (A[x][y + 1] == '#') dfs(x, y + 1, A); } return; } int main() { cin >> H >> W; string A[H + 1]; for (int i = 0; i < H; i++) cin >> A[i]; dfs(0, 0, A); string ans; if (seen[H - 2][W - 1] || seen[H - 1][W - 2]) ans = "Possible"; else ans = "Impossible"; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:7: error: 'seen' was not declared in this scope 24 | if (seen[H - 2][W - 1] || seen[H - 1][W - 2]) | ^~~~
s686094495
p03937
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <queue> using namespace std; #define rep(i,n) for(int i = 0; i < (n); ++i) const int INF = 1 << 30; const int INF_NEG = INF * -1; struct sPoint{ int x, y, breadth; }; int H, W; vector<string> A; int breadth[20][20]; // #define GBN_DEBUG int bfs(int startX, int startY) { sPoint start = {startX, startY, 0}; queue<sPoint> qPoint; qPoint.push(start); while(!qPoint.empty()){ sPoint c = qPoint.front(); // current point qPoint.pop(); if (c.x == W - 1 && c.y == H - 1) // ゴールなら return c.breadth; // 現在地の幅を返す if (c.y + 1 < H && A[c.y + 1][c.x] == '#'){ // 下を探索 A[c.y + 1][c.x] = 'x'; breadth[c.y + 1][c.x] = c.breadth + 1; sPoint next = {c.x, c.y + 1, c.breadth + 1}; qPoint.push(next); } if (c.x + 1 < W && A[c.y][c.x + 1] == '#'){ // 右を探索 A[c.y][c.x + 1] = 'x'; breadth[c.y][c.x + 1] = c.breadth + 1; sPoint next = {c.x + 1, c.y, c.breadth + 1}; qPoint.push(next); } } return 0; } int main() { cin >> H >> W; A.resize(H + 9); rep(i, 20) rep(j, 20) breadth[i][j] = -1; rep(i, H) cin >> A[i]; int ret = bfs(0, 0); if (!ret){ // ゴールに到達できなかった場合 puts("Impossible"); return 0; } #ifdef GBN_DEBUG cout << ret << endl << endl; if (ret){ rep(i, H) cout << A[i] << endl; } #endif // bfs() で通れた場所に 'x' 印 // 以下で最短経路の道を 'o' に変更 int x = W - 1, y = H - 1; int b = ret; while(b >= 0){ A[y][x] = 'o'; if (breadth[y - 1][x] == b - 1) --y; // 上か左のどちらかに幅が1つ小さい場所があるはず else --x; --b; if (y < 0) y = 0; if (x < 0) x = 0; } #ifdef GBN_DEBUG rep(i, H) cout << A[i] << endl; #endif bool ans = true; rep(i, H){ if (!ans) break; int first_o = 0; rep(j, W) if (A[j][i] == 'o') {first_o = j; break;} for (j, W){ if (A[j][i] == 'x' && j < first_o){ // 最初の x が 最初の o より左なら ans = false; break; } } } if (ans) puts("Possible"); else puts("Impossible"); return 0; }
a.cc: In function 'int main()': a.cc:96:14: error: 'j' was not declared in this scope 96 | for (j, W){ | ^ a.cc:102:5: error: expected primary-expression before '}' token 102 | } | ^ a.cc:101:10: error: expected ';' before '}' token 101 | } | ^ | ; 102 | } | ~ a.cc:102:5: error: expected primary-expression before '}' token 102 | } | ^ a.cc:101:10: error: expected ')' before '}' token 101 | } | ^ | ) 102 | } | ~ a.cc:96:13: note: to match this '(' 96 | for (j, W){ | ^ a.cc:102:5: error: expected primary-expression before '}' token 102 | } | ^
s747953437
p03937
C++
#include <bits/stdc++.h> using namespace std; #define lli long long int #define REP(i,s,n) for(int i=s;i<n;i++) #define MOD 1000000007 #define NUM 2520 #define DEBUG 0 #define mp(a,b) make_pair(a,b) #define SORT(V) sort(V.begin(),V.end()) #define PI (3.141592653589794) #define INF (1LL<<50) signed main(){ lli h,w; cin>>h>>w; lli data[10][10]={0} REP(i,0,h)REP(j,0,w){ char tmp; cin>>tmp; data[i][j]=(tmp=='#'); } lli sx=0,sy=0; if(data[sy][sx]==0){ cout<<"Impossible"<<endl; return 0; } while(1){ data[sy][sx]=0; if(data[sy][sx+1]==1)sx++; else{ if(data[sy+1][sx]==1)sy++; else{ break; } } } if(sy!=(h-1) && sx!=(w-1)){ cout<<"Impossible"<<endl; return 0; } REP(i,0,h)REP(j,0,w){ if(data[i][j]){ cout<<"Impossible"<<endl; return 0; } } cout<<"Possible"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:20: error: expected ',' or ';' before 'for' 6 | #define REP(i,s,n) for(int i=s;i<n;i++) | ^~~ a.cc:21:9: note: in expansion of macro 'REP' 21 | REP(i,0,h)REP(j,0,w){ | ^~~ a.cc:21:13: error: 'i' was not declared in this scope 21 | REP(i,0,h)REP(j,0,w){ | ^ a.cc:6:32: note: in definition of macro 'REP' 6 | #define REP(i,s,n) for(int i=s;i<n;i++) | ^ a.cc:21:23: error: 'j' was not declared in this scope 21 | REP(i,0,h)REP(j,0,w){ | ^ a.cc:6:32: note: in definition of macro 'REP' 6 | #define REP(i,s,n) for(int i=s;i<n;i++) | ^
s308131864
p03937
C++
#include <bits/stdc++.h> using namespace std; int main() { int h,w; cin >> h >> w; vector<string> vec(h); for(int i=0;i<h;i++) cin >> vec[i]; bool a=true; for(int i=0;i<h+w;i++){ int k=0; for(int j=max(0,i-h);j<min(w,i);j++){ if(vec.at(j).at(i-j)=="#"){ k++; if(k==2){ bool a=false; break; } } } if(a==true) cout << "Possible" << endl; else cout << "Impossible" << endl; }
a.cc: In function 'int main()': a.cc:14:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(vec.at(j).at(i-j)=="#"){ | ~~~~~~~~~~~~~~~~~^~~~~ a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s549867181
p03937
C++
#include <bits/stdc++.h> using namespace std; int main(){ int h,w; cin >> h >> w; char a[h][w]; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ cin >> a[i][j]; } } string ans="Possible" for(int i=0;i<h-1;i++){ for(int j=1;j<w;j++){ if(a[i][j]=='#'&&a[i+1][j-1]=='#'){ ans="Impossible"; } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:5: error: expected ',' or ';' before 'for' 14 | for(int i=0;i<h-1;i++){ | ^~~ a.cc:14:17: error: 'i' was not declared in this scope 14 | for(int i=0;i<h-1;i++){ | ^
s226750088
p03937
C++
#include<bits/stdc++.h> #define rep(i,N) for(int i=0;i<N;i++) #define rep2(i,N) for(int i=1;i<=N;i++) using namespace std; long long INF=1e18; long long mod=1e9+7; char maze[10][10]; int main(){ int h,w; cin>>h>>w; int cnt=0; rep(i,h)rep(k,w){cin>>maze[i][k]; if(maze[i][k]=='#')cnt++; } queue<int>q; int dx[2]={0,1}; int dy[2]={1,0}; q.push(0); q.push(0); bool ansans=(cnt ==h+w-1); while(!q.empty()){ int nowx=q.front();q.pop(); int nowy=q.front();q.pop(); if(nowx==w-1 && nowy==h-1)break; int cnt2=0; rep(i,2){ int nx=nowx+dx[i]; int ny=nowy+dy[i]; if(nx>=w||ny>=h)continue; if(maze[ny][nx]=='#'){ cnt2++; q.push(nx); q.push(ny); } } if(cnt2!=1){ ans=false; break; } } if(ans){ cout<<"Possible"<<endl; } else{ cout<<"Impossible"<<endl; } return 0; } /* 2 2 .# .# 4 5 #.... ##... .#... .#### 4 5 ##..# .##.. ..#.. ..### */
a.cc: In function 'int main()': a.cc:53:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 53 | ans=false; | ^~~ | abs a.cc:61:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 61 | if(ans){ | ^~~ | abs
s721194654
p03937
C++
#include <bits/stdc++.h> using namespace std; #define dump(x) cout << (x) << '\n' #define Int int64_t #define fi first #define se second #define all(x) (x).begin(), (x).end() Int INF = 1e18; int inf = 1e9; Int mod = 1e9+7; int main() { Int h, w; cin >> h >> w; char f[10][10] = {}; for (Int i = 0; i < h; i++) { for (Int j = 0; j < w; j++) { cin >> f[i][j]; } } queue<pair<Int, Int>> q; q.push({0, 0); while (not q.empty()) { pair<Int, Int> p = q.front(); q.pop(); Int dx[] = {1, 0}; Int dy[] = {0, 1}; for (Int i = 0; i < 2; i++) { Int ny = dy[i] + p.fi; Int nx = dx[i] + p.se; if (ny < 0 or ny == h or nx < 0 or ny == w) continue; if (f[ny][nx == '.']) continue; f[p.fi][p.se] = '.'; q.push({ny, nx}); break; } } bool check = true; for (Int i = 0; i < h; i++) { for (Int j = 0; j < w; j++) { if (f[i][j] == '#') check = false; } } dump(not check ? "Impossible" : "Possible"); return 0; }
a.cc: In function 'int main()': a.cc:24:17: error: expected '}' before ')' token 24 | q.push({0, 0); | ~ ^
s896047446
p03937
C++
#[allow(unused_imports)] use std::char::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; use std::io::*; use std::str::FromStr; #[allow(unused_macros)] macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}} #[allow(unused_macros)] macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};} #[allow(unused_macros)] macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};} #[allow(unused_macros)] macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};} #[derive(PartialEq, PartialOrd)] pub struct Total<T>(pub T); impl<T: PartialEq> Eq for Total<T> {} impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() } } #[allow(dead_code)] const MAX: usize = 100006; #[allow(dead_code)] const INF_U32: u32 = 1 << 31; #[allow(dead_code)] const INF_I32: i32 = 1 << 30; #[allow(dead_code)] const INF_U64: u64 = 1 << 63; #[allow(dead_code)] const INF_I64: i64 = 1 << 62; #[allow(dead_code)] const MOD: i64 = 1e9 as i64 + 7; #[allow(dead_code)] fn read<T: FromStr>() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") } #[allow(dead_code)] fn read_vec<T: std::str::FromStr>() -> Vec<T> { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() } #[allow(unused_imports)] use std::f64; fn dfs(y:usize, x:usize, cnt_f:i64, cnt_a:i64, a:&Vec<Vec<char>>, h:usize, w:usize) -> bool { //debug!(y,x,cnt_f); if y==h-1 && x==w-1 { if cnt_f == cnt_a { return true; } } if x+1 < w && a[y][x+1]=='#' { return dfs(y,x+1,cnt_f+1,cnt_a,a,h,w); } if y+1 < h && a[y+1][x] == '#' { return dfs(y+1,x,cnt_f+1,cnt_a,a,h,w); } return false; } fn main() { input!{h:usize, w:usize, a:[chars;h]}; let mut cnt = 0i64; for i in 0..h { for j in 0..w { if a[i][j] == '#' { cnt+=1; } } } println!("{}",if dfs(0,0,1,cnt,&a,h,w) {"Possible"} else {"Impossible"}); }
a.cc:1:2: error: invalid preprocessing directive #[ 1 | #[allow(unused_imports)] | ^ a.cc:3:2: error: invalid preprocessing directive #[ 3 | #[allow(unused_imports)] | ^ a.cc:5:2: error: invalid preprocessing directive #[ 5 | #[allow(unused_imports)] | ^ a.cc:10:2: error: invalid preprocessing directive #[ 10 | #[allow(unused_macros)] | ^ a.cc:12:2: error: invalid preprocessing directive #[ 12 | #[allow(unused_macros)] | ^ a.cc:14:2: error: invalid preprocessing directive #[ 14 | #[allow(unused_macros)] | ^ a.cc:16:2: error: invalid preprocessing directive #[ 16 | #[allow(unused_macros)] | ^ a.cc:17:126: error: too many decimal points in number 17 | macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};} | ^~~~~~~ a.cc:19:2: error: invalid preprocessing directive #[ 19 | #[derive(PartialEq, PartialOrd)] | ^ a.cc:24:13: error: too many decimal points in number 24 | self.0.partial_cmp(&other.0).unwrap() | ^~~~~~~~~~~~~~ a.cc:28:2: error: invalid preprocessing directive #[ 28 | #[allow(dead_code)] | ^ a.cc:30:2: error: invalid preprocessing directive #[ 30 | #[allow(dead_code)] | ^ a.cc:32:2: error: invalid preprocessing directive #[ 32 | #[allow(dead_code)] | ^ a.cc:34:2: error: invalid preprocessing directive #[ 34 | #[allow(dead_code)] | ^ a.cc:36:2: error: invalid preprocessing directive #[ 36 | #[allow(dead_code)] | ^ a.cc:38:2: error: invalid preprocessing directive #[ 38 | #[allow(dead_code)] | ^ a.cc:41:2: error: invalid preprocessing directive #[ 41 | #[allow(dead_code)] | ^ a.cc:54:2: error: invalid preprocessing directive #[ 54 | #[allow(dead_code)] | ^ a.cc:64:2: error: invalid preprocessing directive #[ 64 | #[allow(unused_imports)] | ^ a.cc:87:14: error: too many decimal points in number 87 | for i in 0..h { | ^~~~ a.cc:88:18: error: too many decimal points in number 88 | for j in 0..w { | ^~~~ a.cc:2:1: error: 'use' does not name a type 2 | use std::char::*; | ^~~ a.cc:4:1: error: 'use' does not name a type 4 | use std::cmp::*; | ^~~ a.cc:6:1: error: 'use' does not name a type 6 | use std::collections::*; | ^~~ a.cc:7:1: error: 'use' does not name a type 7 | use std::io::*; | ^~~ a.cc:8:1: error: 'use' does not name a type 8 | use std::str::FromStr; | ^~~ a.cc:11:1: error: 'macro_rules' does not name a type 11 | macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}} | ^~~~~~~~~~~ a.cc:13:1: error: 'macro_rules' does not name a type 13 | macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};} | ^~~~~~~~~~~ a.cc:15:1: error: 'macro_rules' does not name a type 15 | macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};} | ^~~~~~~~~~~ a.cc:17:1: error: 'macro_rules' does not name a type 17 | macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};} | ^~~~~~~~~~~ a.cc:20:1: error: 'pub' does not name a type 20 | pub struct Total<T>(pub T); | ^~~ a.cc:21:1: error: 'impl' does not name a type 21 | impl<T: PartialEq> Eq for Total<T> {} | ^~~~ a.cc:22:1: error: 'impl' does not name a type 22 | impl<T: PartialOrd> Ord for Total<T> { | ^~~~ a.cc:29:10: error: found ':' in nested-name-specifier, expected '::' 29 | const MAX: usize = 100006; | ^ | :: a.cc:29:7: error: 'MAX' does not name a type 29 | const MAX: usize = 100006; | ^~~ a.cc:31:14: error: found ':' in nested-name-specifier, expected '::' 31 | const INF_U32: u32 = 1 << 31; | ^ | :: a.cc:31:7: error: 'INF_U32' does not name a type 31 | const INF_U32: u32 = 1 << 31; | ^~~~~~~ a.cc:33:14: error: found ':' in nested-name-specifier, expected '::' 33 | const INF_I32: i32 = 1 << 30; | ^ | :: a.cc:33:7: error: 'INF_I32' does not name a type 33 | const INF_I32: i32 = 1 << 30; | ^~~~~~~ a.cc:35:14: error: found ':' in nested-name-specifier, expected '::' 35 | const INF_U64: u64 = 1 << 63; | ^ | :: a.cc:35:7: error: 'INF_U64' does not name a type 35 | const INF_U64: u64 = 1 << 63; | ^~~~~~~ a.cc:37:14: error: found ':' in nested-name-specifier, expected '::' 37 | const INF_I64: i64 = 1 << 62; | ^ | :: a.cc:37:7: error: 'INF_I64' does not name a type 37 | const INF_I64: i64 = 1 << 62; | ^~~~~~~ a.cc:39:10: error: found ':' in nested-name-specifier, expected '::' 39 | const MOD: i64 = 1e9 as i64 + 7; | ^ | :: a.cc:39:7: error: 'MOD' does not name a type 39 | const MOD: i64 = 1e9 as i64 + 7; | ^~~ a.cc:42:1: error: 'fn' does not name a type 42 | fn read<T: FromStr>() -> T { | ^~ a.cc:55:1: error: 'fn' does not name a type 55 | fn read_vec<T: std::str::FromStr>() -> Vec<T> { | ^~ a.cc:65:1: error: 'use' does not name a type 65 | use std::f64; | ^~~ a.cc:67:1: error: 'fn' does not name a type 67 | fn dfs(y:usize, x:usize, cnt_f:i64, cnt_a:i64, a:&Vec<Vec<char>>, h:usize, w:usize) -> bool { | ^~ a.cc:83:1: error: 'fn' does not name a type 83 | fn main() { | ^~
s246020258
p03937
C++
#include "pch.h" #include <iostream> #include <string> #include <vector> #include <cmath> #include <queue> #include <map> #include <set> #include <stack> #include<algorithm> #include<sstream> #include<iomanip> #include<deque> #include<list> using namespace std; typedef long long ll; typedef pair<int, int> pii; const ll MOD_CONST = 1000000007; const ll BIG_NUM = 1000000000000000000; const int BIG_INT = 1000000000; int main() { int h, w; cin >> h >> w; vector<string> a(h+2); a[0] = string(w + 2, ','); for (int i = 1;i <=h;i++) { string s; cin >> s; a[i] = "."; a[i] += s; a[i] += '.'; } a[h + 1] = string(w + 2, ','); bool canConsist = true; for (int i = 1; i <=h;i++) { for (int j = 1; j <=w;j++) { if (i == h && j == w) { break; } if (a[i][j] == '#') { if (a[i + 1][j] != '#' && a[i][j + 1] != '#') { canConsist = false; break; } int cnt = 0; if (a[i][j + 1] == '#') { cnt++; } if (a[i][j - 1] == '#') { cnt++; } if (a[i + 1][j] == '#') { cnt++; } if (a[i - 1][j] == '#') { cnt++; } if (cnt > 2) { canConsist = false; break; } } } if (!canConsist) { break; } } cout << (canConsist ? "Possible" : "Impossible") << endl; }
a.cc:1:10: fatal error: pch.h: No such file or directory 1 | #include "pch.h" | ^~~~~~~ compilation terminated.
s133565709
p03937
C++
#include<iosteram> using namespace std; int main(){ int H,W; cin >> H >> W; cout << H+W-1; }
a.cc:1:9: fatal error: iosteram: No such file or directory 1 | #include<iosteram> | ^~~~~~~~~~ compilation terminated.
s390073289
p03937
C++
#include <bits/stdc++.h> using namespace std; int main(){ int H,W; cin >> H >> W; int C = 0; char c; for (int i = 0; i < H * W; i++){ cin >> c; if (c == '#') C++; } cout << (C = H + W - 1 ? "Possible" : "Impossible"); }
a.cc: In function 'int main()': a.cc:12:26: error: invalid conversion from 'const char*' to 'int' [-fpermissive] 12 | cout << (C = H + W - 1 ? "Possible" : "Impossible"); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | const char*
s940901428
p03937
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) #define ll long long using namespace std; int main(){ int h,w;cin>>h>>w; set<pair<int, int>> moved; rep(y, h){ string s;cin>>s; rep(x,w){ if(s[x]=='#')moved.insert(make_pair(y,x)); } } bool f=true; rep(y, h){ rep(x,w){ bool d_r = !(moved.count(make_pair(y+1, x)) ^ moved.count(make_pair(y, x+1))); bool u_l = !(moved.count(make_pair(y-1, x)) ^ moved.count(make_pair(y, x-1))); if( (y==0 && x==0 && d_r) || (y==h-1 && x==w-1 && u_l) ){ f=false;break; }else if( moved.count(make_pair(y,x)) && (u_l || d_r) ) ){ //cout<<y<<' '<<x<<endl; f=false;break; } } } if(f) cout<<"Possible"; else cout<<"Impossible"; return 0; }
a.cc: In function 'int main()': a.cc:26:63: error: expected primary-expression before ')' token 26 | }else if( moved.count(make_pair(y,x)) && (u_l || d_r) ) ){ | ^
s366849605
p03937
C++
#include <bits/stdc++.h> #define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) #define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++) #define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--) #define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--) #define ALL(v) (v).begin(),(v).end() #define MOD 1000000007 #define NIL -1 #define FI first #define SE second #define MP make_pair #define PB push_back #define SZ(x) (int)x.size() #define SP(x) setprecision((int)x) using namespace std ; typedef long long ll; typedef vector<int> vint; typedef vector<vint> vvint; typedef vector<string> vstr; typedef pair<int, int> pii; const int INF = 1e9; const ll LINF = 1e18; const double EPS = 1e-9; ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数 ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数 //------------------------------------------------- //コピペするとこ //------------------------------------------------- int main() { int h, w ; cin >> h >> w ; vector<string> s(h) ; REP(i,h){ cin >> s.at(i) ; } if(s.at(0).st(0)=='.' || s.at(h-1).st(w-1)=='.'){ cout <<"Impossible"<<endl ; return 0 ; } int i=0 ; int j=0 ; while(true){ if(s.at(i+1).at(j)=='.'&&s.at(i).at(j+1)=='#'){ i++ ; } else if(s.at(i).at(j+1)=='.'&&s.at(i+1).at(j)=='#'){ j++ ; } if(i==h-1 &&j==w-1){ cout <<"Possible"<<endl ; return 0 ; } if(i==h || j==w){ cout <<"Impossible"<<endl ; return 0 ; } } return 0 ; }
a.cc: In function 'int main()': a.cc:46:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'st'; did you mean 'at'? 46 | if(s.at(0).st(0)=='.' || s.at(h-1).st(w-1)=='.'){ | ^~ | at a.cc:46:38: error: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'st'; did you mean 'at'? 46 | if(s.at(0).st(0)=='.' || s.at(h-1).st(w-1)=='.'){ | ^~ | at
s591945187
p03937
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < (int)n; ++i) using namespace std; int H, W; bool dfs(int x, int y, vector<vector<int>> v) { if (x == W - 1 && y == H - 1) return true; if (x == W - 1) { if (v[y + 1][x] == 1) return dfs(x, y + 1, v); else return false; } if (y == H - 1) { if (v[y][x + 1] == 1) return dfs(x + 1, y, v); else return false; } if ((v[y][x + 1] == 1 && v[y + 1][x] == 1) || (v[y][x + 1] == 0 && v[y + 1][x] == 0) return false; if (v[y][x + 1] == 1) return dfs(x + 1, y, v); else return dfs(x, y + 1, v); } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> H >> W; vector<int> _v(W); vector<vector<int>> v(H, _v); REP(i, H) { string A; cin >> A; REP(j, W) { if (A[j] == '#') v[i][j] = 1; else v[i][j] = 0; } } if (!dfs(0, 0, v)) cout << "Impossible" << '\n'; else cout << "Possible" << '\n'; }
a.cc: In function 'bool dfs(int, int, std::vector<std::vector<int> >)': a.cc:19:89: error: expected ';' before 'return' 19 | if ((v[y][x + 1] == 1 && v[y + 1][x] == 1) || (v[y][x + 1] == 0 && v[y + 1][x] == 0) return false; | ^~~~~~~ | ; a.cc:20:5: error: expected primary-expression before 'if' 20 | if (v[y][x + 1] == 1) return dfs(x + 1, y, v); | ^~ a.cc:19:103: error: expected ')' before 'if' 19 | if ((v[y][x + 1] == 1 && v[y + 1][x] == 1) || (v[y][x + 1] == 0 && v[y + 1][x] == 0) return false; | ~ ^ | ) 20 | if (v[y][x + 1] == 1) return dfs(x + 1, y, v); | ~~ a.cc:22:1: warning: control reaches end of non-void function [-Wreturn-type] 22 | } | ^
s604287803
p03937
C++
#include <bits/stdc++.h> #define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) #define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++) #define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--) #define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--) #define ALL(v) (v).begin(),(v).end() #define MOD 1000000007 #define FI first #define SE second #define MP make_pair #define PB push_back #define SZ(x) (int)x.size() #define SP(x) setprecision((int)x) using namespace std ; typedef long long ll; typedef vector<int> vint; typedef vector<vint> vvint; typedef vector<string> vstr; typedef pair<int, int> pii; const int INF = 1e9; const ll LINF = 1e18; const double EPS = 1e-9; ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数 ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数 int main() { int h, w ; cin >> h >> w ; vector<int> vec(h,vector<int>(w)) ; REP(i,h){ REP(j,w){ cin >> vec.at(i).at(j) ; } } int cnt = 0 ; bool flag1 = false ; int i = 0; int j = 0; while(i==h-1 && j==w-1){ if(vec.at(i+1).at(j)=='#'){ i = i+1 ; cnt++ ; } if(vec.at(i).at(j+1)=='.'){ j++ ; cnt++ ; } if(cnt!=1){ cout <<"Impossible"<<endl ; return 0 ; } cnt = 0 ; } cout <<"Possible"<<endl ; return 0 ; }
a.cc: In function 'int main()': a.cc:33:35: error: no matching function for call to 'std::vector<int>::vector(int&, std::vector<int>)' 33 | vector<int> vec(h,vector<int>(w)) ; | ^ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: a.cc:33:35: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 33 | vector<int> vec(h,vector<int>(w)) ; | ^ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int; value_type = int; allocator_type = std::allocator<int>]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<int>::value_type&' {aka 'const int&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int; allocator_type = std::allocator<int>]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<int>::allocator_type&' {aka 'const std::allocator<int>&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided a.cc:37:24: error: request for member 'at' in 'vec.std::vector<int>::at(((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 37 | cin >> vec.at(i).at(j) ; | ^~ a.cc:49:20: error: request for member 'at' in 'vec.std::vector<int>::at(((std::vector<int>::size_type)(i + 1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 49 | if(vec.at(i+1).at(j)=='#'){ | ^~ a.cc:53:18: error: request for member 'at' in 'vec.std::vector<int>::at(((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 53 | if(vec.at(i).at(j+1)=='.'){ | ^~
s610545484
p03937
C++
#include "cstdio" int i,j,n,m,ss,sss; int main(){ scanf("%d%d",&n,&m); for(i=1;i<=n;i++){ getchar(); for(j=1;j<=m;j++){ char c=getchar(); if(c=='#')ss++; } } if(ss!=n+m-1)printf("Impossible\n"); else printf("Possible\n"); returnn 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'returnn' was not declared in this scope 14 | returnn 0; | ^~~~~~~
s965790944
p03937
C++
#include<bits/stdc++.h> using namespace std; int a[10][10],m,n,flag; char kk[10]; void act(int x,int y){ if(x==m-1&&y==n-1){ for(int i=0;i<m;++i)for(int j=0;j<n;++j){ if(a[i][j])return; } flag=1; return; } if(flag==1)return; if(a[x+1][y]){ a[x+1][y]=0; act(x+1,y); a[x+1][y]=1; } if(a[x][y+1]){ a[x][y+1]=0; act(x,y+1); a[x][y+1]=1; } if(!a[x][y+1]&&!a[x+1][y])return; } int main(){ scanf("%d%d",&m,&n); for(int i=0;i<=m;++i){ gets(kk); for(int j=0;j<n;++j) if(kk[j]=='#')a[i-1][j]=1; } if(a[0][0]){ a[0][0]=0; act(0,0); } if(flag)cout<<"Possible"<<endl; else cout<<"Impossible"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 29 | gets(kk); | ^~~~ | getw