submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s352230424
p00489
C++
using System; using System.Linq; class aoj { static void Main() { int a = int.Parse(Console.ReadLine()); int[] b = new int[a]; for (int i = 0; i < a*(a-1)/2; i++) { int[] c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); if (c[2] < c[3]) b[c[1] - 1] += 3; else if (c[2] > c[3]) b[c[0] - 1] += 3; else { b[c[0] - 1] += 1; b[c[1] - 1] += 1; } } int d = 0, e = 1, k = 0; bool[] f = new bool[a]; int[] g = new int[a]; while(true) { int h = 0; d = 0; for (int i = 0; i < a; i++) { if (b[i] > d&&f[i]==false) d = b[i]; } for(int i = 0; i < a; i++) { if (b[i] >= d && f[i] == false) { h++; f[i] = true; g[i] = e;k++; } } e += h; if (k == a) break; } foreach (int i in g) Console.WriteLine(i); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Linq; | ^~~~~~ a.cc:49:2: error: expected ';' after class definition 49 | } | ^ | ; a.cc: In static member function 'static void aoj::Main()': a.cc:7:17: error: expected primary-expression before 'int' 7 | int a = int.Parse(Console.ReadLine()); | ^~~ a.cc:8:12: error: structured binding declaration cannot have type 'int' 8 | int[] b = new int[a]; | ^~ a.cc:8:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:8:12: error: empty structured binding declaration a.cc:8:15: error: expected initializer before 'b' 8 | int[] b = new int[a]; | ^ a.cc:11:16: error: structured binding declaration cannot have type 'int' 11 | int[] c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); | ^~ a.cc:11:16: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:11:16: error: empty structured binding declaration a.cc:11:19: error: expected initializer before 'c' 11 | int[] c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); | ^ a.cc:12:17: error: 'c' was not declared in this scope 12 | if (c[2] < c[3]) | ^ a.cc:13:17: error: 'b' was not declared in this scope 13 | b[c[1] - 1] += 3; | ^ a.cc:15:17: error: 'b' was not declared in this scope 15 | b[c[0] - 1] += 3; | ^ a.cc:18:17: error: 'b' was not declared in this scope 18 | b[c[0] - 1] += 1; | ^ a.cc:23:13: error: structured binding declaration cannot have type 'bool' 23 | bool[] f = new bool[a]; | ^~ a.cc:23:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:23:13: error: empty structured binding declaration a.cc:23:16: error: expected initializer before 'f' 23 | bool[] f = new bool[a]; | ^ a.cc:24:12: error: structured binding declaration cannot have type 'int' 24 | int[] g = new int[a]; | ^~ a.cc:24:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:24:12: error: empty structured binding declaration a.cc:24:15: error: expected initializer before 'g' 24 | int[] g = new int[a]; | ^ a.cc:31:21: error: 'b' was not declared in this scope 31 | if (b[i] > d&&f[i]==false) | ^ a.cc:31:31: error: 'f' was not declared in this scope 31 | if (b[i] > d&&f[i]==false) | ^ a.cc:36:21: error: 'b' was not declared in this scope 36 | if (b[i] >= d && f[i] == false) | ^ a.cc:36:34: error: 'f' was not declared in this scope 36 | if (b[i] >= d && f[i] == false) | ^ a.cc:40:21: error: 'g' was not declared in this scope 40 | g[i] = e;k++; | ^ a.cc:46:18: error: expected primary-expression before 'int' 46 | foreach (int i in g) | ^~~ a.cc:46:9: error: 'foreach' was not declared in this scope 46 | foreach (int i in g) | ^~~~~~~
s459562010
p00489
C++
#include<stdio.h> int main() { int i,j,A,B,a,b,m,n,max,min,r; int st1[100]; scanf("%d",&n); r=n*(n-1)/2; for(i=0;i<r;i++){ scanf("%d %d %d %d",&a,&b,&c,&d); if(c>d){ str[a]+=3; str[b]+=0; } else if(d<c){ str[b]+=3; str[a]+=0; } else{ str[a]+=1; str[b]+=1; } } for(i=0;i<n;i++){ printf("%d\n",str[i]); } return 0; }
a.cc: In function 'int main()': a.cc:9:44: error: 'c' was not declared in this scope 9 | scanf("%d %d %d %d",&a,&b,&c,&d); | ^ a.cc:9:47: error: 'd' was not declared in this scope 9 | scanf("%d %d %d %d",&a,&b,&c,&d); | ^ a.cc:11:33: error: 'str' was not declared in this scope; did you mean 'st1'? 11 | str[a]+=3; | ^~~ | st1 a.cc:15:33: error: 'str' was not declared in this scope; did you mean 'st1'? 15 | str[b]+=3; | ^~~ | st1 a.cc:19:33: error: 'str' was not declared in this scope; did you mean 'st1'? 19 | str[a]+=1; | ^~~ | st1 a.cc:24:39: error: 'str' was not declared in this scope; did you mean 'st1'? 24 | printf("%d\n",str[i]); | ^~~ | st1
s550544138
p00489
C++
#include<iostream> using namespace std; struct S{ int a; int b; bool operator > (const S& s)const { if(a < s.a){ return true; } return false; } bool operator > (const S& s)const { if(a > s.a){ return true; } return false; } }; #include<aigorithm> int main() { S st[101]={}; int A,B,C,D,i,n; cin>>n; for(i=1;i<=n;i++){ st[i].a=i; } m=n(n-1)/2; for(i=0;i<m;i++){ cin>>A>>B>>C>>D; if(A>B){ st.b[C]+=3; } else if(A<B){ st.b[D]+=3; } else{ st.b[D]++; st.b[C]++; } } sort(st.b,n); cout<<st[i].a return 0; }
a.cc:21:9: fatal error: aigorithm: No such file or directory 21 | #include<aigorithm> | ^~~~~~~~~~~ compilation terminated.
s542509593
p00489
C++
#include<iostream> using namespace std; struct S{ int a; int b; bool operator > (const S& s)const { if(a < s.a){ return true; } return false; } bool operator > (const S& s)const { if(a > s.a){ return true; } return false; } }; #include<aigorithm> int main() { S st[101]={}; int A,B,C,D,i,n; cin>>n; for(i=1;i<=n;i++){ st[i].a=i; } m=n(n-1)/2; for(i=0;i<m;i++){ cin>>A>>B>>C>>D; if(C>D){ st.b[A]+=3; } else if(C<D){ st.b[B]+=3; } else{ st.b[B]++; st.b[A]++; } } sort(st.b,n); cout<<st[i].a return 0; }
a.cc:21:9: fatal error: aigorithm: No such file or directory 21 | #include<aigorithm> | ^~~~~~~~~~~ compilation terminated.
s402742274
p00489
C++
#include<iostream> using namespace std; struct S{ int a; int b; bool operator > (const S& s)const { if(a < s.a){ return true; } return false; } bool operator > (const S& s)const { if(a > s.a){ return true; } return false; } }; #include<aigorithm> int main() { S st[101]={}; int A,B,C,D,i,n; cin>>n; for(i=1;i<=n;i++){ st.a[i]=i; } m=n(n-1)/2; for(i=0;i<m;i++){ cin>>A>>B>>C>>D; if(C>D){ st.b[A]+=3; } else if(C<D){ st.b[B]+=3; } else{ st.b[B]++; st.b[A]++; } } sort(st.b,n); cout<<st[i].a return 0; }
a.cc:21:9: fatal error: aigorithm: No such file or directory 21 | #include<aigorithm> | ^~~~~~~~~~~ compilation terminated.
s620724925
p00489
C++
#include<iostream> using namespace std; #include<aigorithm> int main() { int sta[101]={},stb[101]={}; int A,B,C,D,i,n,m,j; cin>>n; for(i=1;i<=n;i++){ sta[i]=i; } m=n*(n-1)/2; for(i=0;i<m;i++){ cin>>A>>B>>C>>D; if(C>D){ stb[A]+=3; } else if(C<D){ stb[B]+=3; } else{ stb[B]++; stb[A]++; } } for(i=1;i<=n-1;i++){ for(j=i+1;j<n;j++){ if(stb[i]<stb[j]){ m=stb[i]; stb[i]=stb[j]; stb[j]=m; } } } for(i=1;i<=n;i++){ cout<<sta[i]<<endl; } return 0; }
a.cc:3:9: fatal error: aigorithm: No such file or directory 3 | #include<aigorithm> | ^~~~~~~~~~~ compilation terminated.
s963423959
p00489
C++
#include<iostream> using namespace std; #include<algorithm> int main() { int sta[101]={},stb[101]={}; int A,B,C,D,i,n,m,j; cin>>n; for(i=1;i<=n;i++){ sta[i]=i; } m=n*(n-1)/2; for(i=0;i<m;i++){ cin>>A>>B>>C>>D; if(C>D){ stb[A]+=3; } else if(C<D){ stb[B]+=3; } else{ stb[B]++; stb[A]++; } } for(i=1;i<=n-1;i++){ for(j=i+1;j<=n;j++){ if(stb[i]<stb[j]){ m=stb[i]; stb[i]=stb[j]; stb[j]=m; m=sta[i]; sta[i]=sta[j]; sta[j]=m; } } } for(i=1;i<=n;i++){ cout<<sta[i]<<endl; } return 0;
a.cc: In function 'int main()': a.cc:43:18: error: expected '}' at end of input 43 | return 0; | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s383453237
p00489
C++
#include <stdio.h> int main(){ int n,team[100]={0},num[100],rank[100],ta,tb,sa,sb,i,j; int blank; scanf("%d",&n); for(i = 0; i < (n*n-n)/2; i++){ scanf("%d %d %d %d",&ta,&tb,&sa,&sb); if(sa > sb) team[ta-1] += 3; else if(sa < sb) team[tb-1] += 3; else{ team[ta-1]++; team[tb-1]++; } } for(i = 0; i < n; i++) num[i]=i; for(i = 0; i < n-1; i++){ for(j = 0; j < n-1; j++){ if(team[j] < team[j+1]){ blank=team[j]; team[j]=team[j+1]; team[j+1]=blank; blank=num[j]; num[j]=num[j+1]; num[j+1]=blank; } } } // for(i = 0; i < n; i++) printf("%d\n",num[i]); rank[0]=1; for(i = 1; i < n; i++){ rank[i]=i+1; if(team[i] == team[i-1]) rank[i]=rank[i-1]; } //for(i = 0; i < n; i++) printf("%d\n",rank[i]); for(i = 0; i < n-1; i++){ for(j = 0; j < n-1; j++){ if(num[j] > num[j+1]){ blank=num[j]; num[j]=num[j+1]; num[j+1]=blank; #include <stdio.h> int main(){ int n,team[100]={0},num[100],rank[100],ta,tb,sa,sb,i,j; int blank; scanf("%d",&n); for(i = 0; i < (n*n-n)/2; i++){ scanf("%d %d %d %d",&ta,&tb,&sa,&sb); if(sa > sb) team[ta-1] += 3; else if(sa < sb) team[tb-1] += 3; else{ team[ta-1]++; team[tb-1]++; } } for(i = 0; i < n; i++) num[i]=i; for(i = 0; i < n-1; i++){ for(j = 0; j < n-1; j++){ if(team[j] < team[j+1]){ blank=team[j]; team[j]=team[j+1]; team[j+1]=blank; blank=num[j]; num[j]=num[j+1]; num[j+1]=blank; } } } // for(i = 0; i < n; i++) printf("%d\n",num[i]); rank[0]=1; for(i = 1; i < n; i++){ rank[i]=i+1; if(team[i] == team[i-1]) rank[i]=rank[i-1]; } //for(i = 0; i < n; i++) printf("%d\n",rank[i]); for(i = 0; i < n-1; i++){ for(j = 0; j < n-1; j++){ if(num[j] > num[j+1]){ blank=num[j]; num[j]=num[j+1]; num[j+1]=blank; blank=rank[j]; rank[j]=rank[j+1]; rank[j+1]=blank; } } } //for(i = 0; i < n; i++) printf("%d\n",num[i]); for(i = 0; i < n; i++) printf("%d\n",rank[i]); return 0; } blank=rank[j]; rank[j]=rank[j+1]; rank[j+1]=blank; } } } //for(i = 0; i < n; i++) printf("%d\n",num[i]); for(i = 0; i < n; i++) printf("%d\n",rank[i]); return 0; }
a.cc: In function 'int main()': a.cc:68:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 68 | int main(){ | ^~ a.cc:68:9: note: remove parentheses to default-initialize a variable 68 | int main(){ | ^~ | -- a.cc:68:9: note: or replace parentheses with braces to value-initialize a variable a.cc:68:11: error: a function-definition is not allowed here before '{' token 68 | int main(){ | ^
s120780943
p00489
C++
#include<bits/stdc++.h> using namespace std; int sc[110],index[110],rank[110]; int main(){ int N; cin>>N; for(int i=0;i<N*(N-1)/2;++i){ int a,b,c,d; cin>>a>>b>>c>>d; if(c>d) sc[a-1]+=3; else if(c<d) sc[b-1]+=3; else{ sc[a-1]++; sc[b-1]++; } } for(int i=0;i<N;++i) index[i]=i+1; for(int i=0;i<N;++i){ for(int j=N-1;j!=i;--j){ if(sc[i]<sc[j]){ swap(index[i],index[j]); swap(sc[i],sc[j]); } } } int x=1; for(int i=0;i<N;++i){ if(i>0&&sc[i]==sc[i-1]){ rank[index[i]-1]=rank[index[i-1]-1]; x++; }else rank[index[i]-1]=x++; } for(int i=0;i<N;++i) cout<<rank[i]<<endl; return 0; }
a.cc:3:22: error: 'int index [110]' redeclared as different kind of entity 3 | int sc[110],index[110],rank[110]; | ^ In file included from /usr/include/string.h:462, from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)' 50 | extern const char *index (const char *__s, int __c) | ^~~~~ a.cc: In function 'int main()': a.cc:17:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 17 | for(int i=0;i<N;++i) index[i]=i+1; | ^ a.cc:21:19: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 21 | swap(index[i],index[j]); | ^ a.cc:21:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 21 | swap(index[i],index[j]); | ^ a.cc:29:7: error: reference to 'rank' is ambiguous 29 | rank[index[i]-1]=rank[index[i-1]-1]; | ^~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:3:24: note: 'int rank [110]' 3 | int sc[110],index[110],rank[110]; | ^~~~ a.cc:29:17: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 29 | rank[index[i]-1]=rank[index[i-1]-1]; | ^ a.cc:29:24: error: reference to 'rank' is ambiguous 29 | rank[index[i]-1]=rank[index[i-1]-1]; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:3:24: note: 'int rank [110]' 3 | int sc[110],index[110],rank[110]; | ^~~~ a.cc:29:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 29 | rank[index[i]-1]=rank[index[i-1]-1]; | ^ a.cc:31:11: error: reference to 'rank' is ambiguous 31 | }else rank[index[i]-1]=x++; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:3:24: note: 'int rank [110]' 3 | int sc[110],index[110],rank[110]; | ^~~~ a.cc:31:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 31 | }else rank[index[i]-1]=x++; | ^ a.cc:33:30: error: reference to 'rank' is ambiguous 33 | for(int i=0;i<N;++i) cout<<rank[i]<<endl; | ^~~~ /usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank' 1437 | struct rank | ^~~~ a.cc:3:24: note: 'int rank [110]' 3 | int sc[110],index[110],rank[110]; | ^~~~
s388679151
p00489
C++
#include<iostream> using namespace std; int main(){ int n,a,b,c,d; cin >> n; int A[n]; int B[n]; //n番目のチームの勝ち点 for (int i=0; i<n; i++){ A[i] = 0; B[i] = 0; } for(int i=0; i<n*(n-1)/2; i++){ cin >> a >> b >> c >> d; if( c > d ){ A[a] += 3; B[a] += 3; } if( c < d ){ A[b] += 3; B[b] += 3; } if( c == d ){ A[a] ++; A[b] ++; B[a] ++; B[b] ++; } } A.sort(); A.reverse(); int x = 0; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ x++; if(B[i] == A[j]){ cout << x << endl; x = 0; break; } } } return 0; }
a.cc: In function 'int main()': a.cc:35:11: error: request for member 'sort' in 'A', which is of non-class type 'int [n]' 35 | A.sort(); | ^~~~ a.cc:36:11: error: request for member 'reverse' in 'A', which is of non-class type 'int [n]' 36 | A.reverse(); | ^~~~~~~
s591546395
p00489
C++
#include<iostream> using namespace std; int main(){ int n,a,b,c,d; cin >> n; int A[n]; int B[n]; //n番目のチームの勝ち点 for (int i=0; i<n; i++){ A[i] = 0; B[i] = 0; } for(int i=0; i<n*(n-1)/2; i++){ cin >> a >> b >> c >> d; if( c > d ){ A[a] += 3; B[a] += 3; } if( c < d ){ A[b] += 3; B[b] += 3; } if( c == d ){ A[a] ++; A[b] ++; B[a] ++; B[b] ++; } } sort(A.begin(),A.end()); reverse(A.begin(),A.end()); int x = 0; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ x++; if(B[i] == A[j]){ cout << x << endl; x = 0; break; } } } return 0; }
a.cc: In function 'int main()': a.cc:35:16: error: request for member 'begin' in 'A', which is of non-class type 'int [n]' 35 | sort(A.begin(),A.end()); | ^~~~~ a.cc:35:26: error: request for member 'end' in 'A', which is of non-class type 'int [n]' 35 | sort(A.begin(),A.end()); | ^~~ a.cc:35:9: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(A.begin(),A.end()); | ^~~~ | short a.cc:36:19: error: request for member 'begin' in 'A', which is of non-class type 'int [n]' 36 | reverse(A.begin(),A.end()); | ^~~~~ a.cc:36:29: error: request for member 'end' in 'A', which is of non-class type 'int [n]' 36 | reverse(A.begin(),A.end()); | ^~~ a.cc:36:9: error: 'reverse' was not declared in this scope 36 | reverse(A.begin(),A.end()); | ^~~~~~~
s819870388
p00489
C++
#include <stdio.h> #include <algorithm> #include <utility> using namespace std; typedef pair<int,int> pi; #define F first #define S second const int N=1e2+10; int main(){ int n,a,b,c,d,tot; pi val[N]; scanf("%d",&n); for(int i=1;i<=n;i++)val[i]={0,i}; tot=(n*(n-1))/2 while(tot--){ scanf("%d%d%d%d",&a,&b,&c,&d); if(c==d){ val[a].F++; val[b].F++; } else if(c>d)val[a].F+=3; else val[b].F+=3; } sort(val+1,val+1+n); for(int i=1;i<=n;i++)printf("%d\n",val[i].S); }
a.cc: In function 'int main()': a.cc:14:20: error: expected ';' before 'while' 14 | tot=(n*(n-1))/2 | ^ | ; 15 | while(tot--){ | ~~~~~
s432224532
p00489
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <ctime> #include <cassert> #include <iostream> #include <sstream> #include <string> #include <list> #include <vector> #include <queue> #include <set> #include <map> #include <utility> #include <numeric> #include <algorithm> #include <bitset> #include <complex> #include <fstream> using namespace std; typedef long long ll; typedef vector<int> vint; typedef pair<int, int> pint; #define TO_STRING(a) #a #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i, n) REP(i, 0, n) template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; } template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; } template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); } template<class T> void MSG(T a){ cout << TO_STRING(a) << " = " << a << endl; } int main() { int n; cin >> n; vint score(n); fill(score.begin(), score.end(), 0); rep(i, n*(n-1)/2) { int a, b, c, d; cin >> a >> b >> c >> d; score[a-1] += (c > d ? 3 :(c == d ? 1 : 0)); score[b-1] += (c < d ? 3 :(c == d ? 1 : 0)); } rep(print, n) { int rank = 1; rep(over, n) if(score[print] < score[over]) rank++; cout << rank << endl; } } clone edit download c
a.cc:63:1: error: 'clone' does not name a type 63 | clone edit download c | ^~~~~
s857383211
p00489
C++
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; bool flag[10000000]; int main(void) { int N; int T1, T2, P1, P2; int cnt[100]={0}; int R = 0; int j = 0; while(cin >> N) { memset(cnt, 0, sizeof(cnt)); for(int i = 0 ; i < N*(N-1)/2 ; i++) { cin >> T1 >> T2 >> P1 >> P2; if(P1 > P2) cnt[T1] += 3; else if(P1 < P2) cnt[T2] += 3; else if(P1 == P2) { cnt[T1]++; cnt[T2]++; } } /*for(int i = 1 ; i <= N ; i++) { cout << cnt[i] << ' '; } cout << endl;*/ for(int i = 1 ; i <= N ; i++) { for(int j = 1 ; j <= N ; j++) { if(cnt[i] < cnt[j]) R++; } cout << R+1 << endl; R = 0; } //cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'memset' was not declared in this scope 13 | memset(cnt, 0, sizeof(cnt)); | ^~~~~~ 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;
s100956895
p00489
C++
#include <stdio.h> int main(){ int n,i,j; scanf("%d",&n); j = n*(n-1); int team[100],score[100],a,b,c,d,e; for(i=0;i<j/2;i++){ scanf("%d%d%d%d",&a,&b,&c,&d); if(c>d){ team[a] += 3; }else if(c<d){ team[b] += 3; }else{ team[a] += 1; team[b] += 1; } } for(e=0;e<100;e++){ score[e] = team[e] } int x; for(i=1;i<n;i++){ for(j=1;j<n;j++){ if(team[j]<team[j+1]){ x = team[j+1]; team[j+1] =team[j]; team[j] = x; } } } int k,l,up; for(k=0;k<n;k++){ for(l=0;l<n;l++){ if(team[k]<team[l]){ up += 1; } } k = up+1; } for(e=0;e<100;e++){ for(f=0;f<100;f++){ if(score[e] ==team[f]){ printf("%d\n",f); } } } return 0; }
a.cc: In function 'int main()': a.cc:19:30: error: expected ';' before '}' token 19 | score[e] = team[e] | ^ | ; 20 | } | ~ a.cc:41:21: error: 'f' was not declared in this scope 41 | for(f=0;f<100;f++){ | ^
s996144027
p00489
C++
#include<iostream> using namespace std; int main(){ int tmp,n,bell,t1,t2,po1,po2,team[110]={0}; cin >> n; bell=n; bell*=n-1; bell/=2; for(int i=0;i<bell;i++){ cin >> t1 >> t2 >> po1 >> po2; if(po1>po2){ team[t1]+=3; } else if(po2>po1){ team[t2]+=3; } else{ team[t1]++; team[t2]++; } } //勝ち点計算終了。 int lank[110][2]={0}; for(int i=0;i<n;i++){ lank[i][0]=team[i]; lank[i][1]=i; } for(int i=0;i<n-1;i++){ for(int j=n-1;j>i;j--){ if(lank[j][0]>lank[j-1][0]){ tmp=lank[j][0]; lank[j][0]=lank[j-1][0]; lank[j-1][0]=tmp; tmp=lank[j][1]; lank[j][1]=lank[j-1][1]; lank[j-1][1]=tmp; } } } //順位付け。 // int lank_ans[110]; int LANK=1,tame=1; for(int i=0;i<n;i++){ tame=1; while(1){ if(lank[i][0]==lank[i+1][0]){ lank[i][0]=LANK; //lank[i+1][0]=LANK; i++; tame++; } } lank[i][0]=LANK LANK+=tame; } //元の並びに戻す。 for(int i=0;i<n-1;i++){ for(int j=n-1;j>i;j--){ if(lank[j][1]<lank[j-1][1]){ /* tmp=lank_ans[j]; lank_ans[j]=lank_ans[j-1]; lank_ans[j-1]=tmp;*/ tmp=lank[j][0]; lank[j][0]=lank[j-1][0]; lank[j-1][0]=tmp; tmp=lank[j][1]; lank[j][1]=lank[j-1][1]; lank[j-1][1]=tmp; } } } for(int i=0;i<n;i++){ cout << lank[i][0] << endl; } return (0); }
a.cc: In function 'int main()': a.cc:59:20: error: expected ';' before 'LANK' 59 | lank[i][0]=LANK | ^ | ; 60 | LANK+=tame; | ~~~~
s604114759
p00489
C++
#include<cstdio> #include <iostream> #include <string> #include<algorithm> #include <map> #pragma warning(disable:4786) // VisualC++6.0の警告対策 using namespace std; #define ll long long #define SINT(n) scanf("%d",&n); #define SINT2(n,m) scanf("%d %d",&n,&m); #define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o); #define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p); #define SLL(n) scanf("%lld",&n); #define SST(s) scanf("%s",&s); #define PINT(n) printf("%d",(int)(n)); #define PINT2(n,m) printf("%d %d",(int)(n),(int)(m)); #define PLL(n) printf("%lld",(long long)(n)); #define PST(s) printf("%s",(s)); #define PCH(s) printf("%c",(s)); #define PINTN(n) printf("%d\n",(int)(n)); #define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m)); #define PLLN(n) printf("%lld\n",(long long)(n)); #define PSTN(s) printf("%s\n",(s)); #define PCHN(s) printf("%c\n",(s)); #define PSP() printf(" "); #define PN() printf("\n"); #define dlp(i) while(i-->0) #define ulp(i) for(ll _hoge_counter_hoge_=i,i=0;i<_hoge_counter_hoge_;i++) #define lp(i) for(ll _hoge_counter_hoge_=i;_hoge_counter_hoge_--;) #define lpp(i,to) for(i=0;i<to;i++) #define lpft(i,from,to) for(i=from;i<to;i++) map<ll, map<ll, short> > memo[50][50][4]; char Map[60][60]; int main(){ int N; int i,j,k; int a,b,c,d; int t[100]; //fill( t, t+sizeof(t), 0 ); memset(t,sizeof(t),0); SINT(N); lpp(i,N*(N-1)/2){ SINT4(a,b,c,d); if(c>d){ t[a-1]+=3; } if(c<d){ t[b-1]+=3; } if(c==d){ t[a-1]++; t[b-1]++; } } lpp(i,N){ a=1; lpp(j,N){ if(t[j]>t[i]) a++; } PINTN(a); } return 0; }
a.cc: In function 'int main()': a.cc:56:9: error: 'memset' was not declared in this scope 56 | memset(t,sizeof(t),0); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <map> +++ |+#include <cstring> 6 | #pragma warning(disable:4786) // VisualC++6.0の警告対策
s210003965
p00489
C++
#include<cstdio> #include <iostream> #include <string> #include<algorithm> #include <map> #pragma warning(disable:4786) // VisualC++6.0の警告対策 using namespace std; #define ll long long #define SINT(n) scanf("%d",&n); #define SINT2(n,m) scanf("%d %d",&n,&m); #define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o); #define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p); #define SLL(n) scanf("%lld",&n); #define SST(s) scanf("%s",&s); #define PINT(n) printf("%d",(int)(n)); #define PINT2(n,m) printf("%d %d",(int)(n),(int)(m)); #define PLL(n) printf("%lld",(long long)(n)); #define PST(s) printf("%s",(s)); #define PCH(s) printf("%c",(s)); #define PINTN(n) printf("%d\n",(int)(n)); #define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m)); #define PLLN(n) printf("%lld\n",(long long)(n)); #define PSTN(s) printf("%s\n",(s)); #define PCHN(s) printf("%c\n",(s)); #define PSP() printf(" "); #define PN() printf("\n"); #define dlp(i) while(i-->0) #define ulp(i) for(ll _hoge_counter_hoge_=i,i=0;i<_hoge_counter_hoge_;i++) #define lp(i) for(ll _hoge_counter_hoge_=i;_hoge_counter_hoge_--;) #define lpp(i,to) for(i=0;i<to;i++) #define lpft(i,from,to) for(i=from;i<to;i++) map<ll, map<ll, short> > memo[50][50][4]; char Map[60][60]; int main(){ int N; int i,j,k; int a,b,c,d; int t[100]; //fill( t, t+sizeof(t), 0 ); std::memset(t,sizeof(t),0); SINT(N); lpp(i,N*(N-1)/2){ SINT4(a,b,c,d); if(c>d){ t[a-1]+=3; } if(c<d){ t[b-1]+=3; } if(c==d){ t[a-1]++; t[b-1]++; } } lpp(i,N){ a=1; lpp(j,N){ if(t[j]>t[i]) a++; } PINTN(a); } return 0; }
a.cc: In function 'int main()': a.cc:56:14: error: 'memset' is not a member of 'std'; did you mean 'wmemset'? 56 | std::memset(t,sizeof(t),0); | ^~~~~~ | wmemset
s877430920
p00489
C++
#include<cstdio> #include <iostream> #include <string> #include<algorithm> #include <map> #pragma warning(disable:4786) // VisualC++6.0の警告対策 using namespace std; #define ll long long #define SINT(n) scanf("%d",&n); #define SINT2(n,m) scanf("%d %d",&n,&m); #define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o); #define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p); #define SLL(n) scanf("%lld",&n); #define SST(s) scanf("%s",&s); #define PINT(n) printf("%d",(int)(n)); #define PINT2(n,m) printf("%d %d",(int)(n),(int)(m)); #define PLL(n) printf("%lld",(long long)(n)); #define PST(s) printf("%s",(s)); #define PCH(s) printf("%c",(s)); #define PINTN(n) printf("%d\n",(int)(n)); #define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m)); #define PLLN(n) printf("%lld\n",(long long)(n)); #define PSTN(s) printf("%s\n",(s)); #define PCHN(s) printf("%c\n",(s)); #define PSP() printf(" "); #define PN() printf("\n"); #define dlp(i) while(i-->0) #define ulp(i) for(ll _hoge_counter_hoge_=i,i=0;i<_hoge_counter_hoge_;i++) #define lp(i) for(ll _hoge_counter_hoge_=i;_hoge_counter_hoge_--;) #define lpp(i,to) for(i=0;i<to;i++) #define lpft(i,from,to) for(i=from;i<to;i++) #define lengthof(x) //#define FILL(a,v)(a, a + (sizeof (a) / sizeof *(a)), v); #define FILL_ZERO(a) memset(a,0,sizeof(a)); #define FILL_ONE(a) memset(a,-1,sizeof(a)); map<ll, map<ll, short> > memo[50][50][4]; char Map[60][60]; int main(){ int N; int i,j,k; int a,b,c,d; int t[100]; FILL_ZERO(t); SINT(N); lpp(i,N*(N-1)/2){ SINT4(a,b,c,d); if(c>d){ t[a-1]+=3; } if(c<d){ t[b-1]+=3; } if(c==d){ t[a-1]++; t[b-1]++; } } lpp(i,N){ a=1; lpp(j,N){ if(t[j]>t[i]) a++; } PINTN(a); } return 0; }
a.cc: In function 'int main()': a.cc:46:22: error: 'memset' was not declared in this scope 46 | #define FILL_ZERO(a) memset(a,0,sizeof(a)); | ^~~~~~ a.cc:60:9: note: in expansion of macro 'FILL_ZERO' 60 | FILL_ZERO(t); | ^~~~~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <map> +++ |+#include <cstring> 6 | #pragma warning(disable:4786) // VisualC++6.0の警告対策
s728627189
p00490
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); int d[] = new int[100]; int e; for(int i = 0; i < n; i++){ d[i] = in.nextInt(); } for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ if(d[i] < d[j]){ e = d[i]; d[i] = d[j]; d[j] = e; } } } for(int i = 0; i < n; i++){ if(d[i] / b > c / a){ c += d[i]; a += b; } } System.out.println(c / a); } }}
Main.java:33: error: class, interface, enum, or record expected }} ^ 1 error
s156623031
p00490
Java
package kadai_2; import java.util.*; public class BestPizza { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int[] D = new int[k]; int x = 0; int y = 0; for(int i = 0; i < k; i++){ D[i] = sc.nextInt(); int kc = C/A; int tc = D[i]/B; if(tc > kc){ x = x+D[i]; y = y+1; } } System.out.println((C+x)/(A+B*y)); } }
Main.java:5: error: class BestPizza is public, should be declared in a file named BestPizza.java public class BestPizza { ^ 1 error
s344965269
p00490
Java
import java.util.*; public class Main2{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] aa = new int[10000]; int res = 0,sum = 0; int n,a,b,c; n = sc.nextInt(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); for(int i=0; i<n; i++){ aa[i] = sc.nextInt(); } Arrays.sort(aa); //Arrays.reverse(aa); for(int i=0; i<=n/2; i++){ int tmp = aa[i]; aa[i] = aa[aa.length-1-i]; aa[aa.length-1-i] = tmp; } for(int i=0; i<n+1; i++){ res = Math.max(res,(c+sum)/(a+b*i)); if(i==n)break; sum += aa[i]; } System.out.println(res); } }
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java public class Main2{ ^ 1 error
s950416799
p00490
Java
package SD; import java.util.Scanner; public class aoj0567 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int toppingtype= sc.nextInt(); int doughprice= sc.nextInt(); int toppingprice= sc.nextInt(); int doughcaroly= sc.nextInt(); int toppingcaroly[] =new int[toppingtype]; for(int i=0;i<toppingtype;i++){ toppingcaroly[i]= sc.nextInt(); } for(int i=0;i<toppingtype-1;i++){ if(toppingcaroly[i]<toppingcaroly[i+1]){ int s=toppingcaroly[i]; toppingcaroly[i]=toppingcaroly[i+1]; toppingcaroly[i+1]=s; } } int normalpizza=doughcaroly/doughprice; int sum=0; for(int i=0;i<toppingtype;i++){ sum=sum+toppingcaroly[i]; int bestpizza=(sum+doughcaroly)/(toppingprice*(i+1)+doughprice); if(normalpizza<bestpizza){ normalpizza=bestpizza; }else if(normalpizza>=bestpizza){ System.out.println(normalpizza); } } } }
Main.java:3: error: class aoj0567 is public, should be declared in a file named aoj0567.java public class aoj0567 { ^ 1 error
s759140092
p00490
Java
package SD; import java.util.Scanner; public class aoj0567 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int toppingtype= sc.nextInt(); int doughprice= sc.nextInt(); int toppingprice= sc.nextInt(); int doughcaroly= sc.nextInt(); int toppingcaroly[] =new int[toppingtype]; for(int i=0;i<toppingtype;i++){ toppingcaroly[i]= sc.nextInt(); } for(int i=0;i<toppingtype-1;i++){ if(toppingcaroly[i]<toppingcaroly[i+1]){ int s=toppingcaroly[i]; toppingcaroly[i]=toppingcaroly[i+1]; toppingcaroly[i+1]=s; } } int normalpizza=doughcaroly/doughprice; int sum=0; for(int i=0;i<toppingtype;i++){ sum=sum+toppingcaroly[i]; int bestpizza=(sum+doughcaroly)/(toppingprice*(i+1)+doughprice); if(normalpizza<bestpizza){ normalpizza=bestpizza; }else if(normalpizza>=bestpizza){ System.out.println(normalpizza); } } } }
Main.java:3: error: class aoj0567 is public, should be declared in a file named aoj0567.java public class aoj0567 { ^ 1 error
s960956508
p00490
Java
import java.util.*; public class Mian { public static void main(String[] args) { Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int [] array = new int[n]; int max = 0, soeji = 0, j, kijyun,hikaku = 0, x = 0; int daikin = 0; int kijikakaku = sc.nextInt(); int sabukakaku = sc.nextInt(); int kiji = sc.nextInt(); for(int i = 0; i < n; i++){ array[i] = sc.nextInt(); } for(int i = 0; i < n; i++){ for(j = i; j < n; j++){ if(j == i){ max = array[j]; } else if (max < array[j]){ max = array[j]; soeji = j; } } array[soeji] = array[i]; array[i] = max; } kijyun = kiji / kijikakaku; for(int i = 0; i < n; i++){ hikaku = array[i] / sabukakaku; if(kijyun >= hikaku){ break; } else { x += array[i]; daikin =kijikakaku+(sabukakaku*(i+1)); kijyun = (kiji + x)/daikin; } } System.out.println(kijyun); } }
Main.java:2: error: class Mian is public, should be declared in a file named Mian.java public class Mian { ^ 1 error
s781824339
p00490
Java
import java.util.Scanner; public class aoj0567 { public static void main(String[] args){ Scanner in = new Scanner(System.in); int N = in.nextInt(); int D = in.nextInt(); int D2 = in.nextInt(); int A = in.nextInt(); int[]B = new int [N+1]; for(int i = 0;i < N;i++){ B[i] = in.nextInt(); } int max = A / D; int cng; for(int i = 0;i < N;i++){ D += D2; B[N] = 0; for(int j = 0;j < N;j++){ if(B[N] < B[j]){ if(B[N] == B[j]){ B[j] = 0; } cng = B[j]; B[j] = B[N]; B[N] = cng; } } A += B[N]; if(max < A / D){ max = A / D; } } System.out.println(max); } }
Main.java:3: error: class aoj0567 is public, should be declared in a file named aoj0567.java public class aoj0567 { ^ 1 error
s766482040
p00490
Java
hh
Main.java:1: error: reached end of file while parsing hh ^ 1 error
s923596659
p00490
C
#include<stdio.h> int main(){ int n,a,b,c,d[100]; int i,maxi; double max,cal[100],tmp; scanf("%d%d%d%d",&n,&a,&b,&c); for(i=0;i<n;i++){ scanf("%d",&d[i]); cal[i]=(double)d[i]/(double)b; } for(i=0;i<n;i++)printf("%f\n",cal[i]); tmp=(double)c/(double)a; printf("%0.0f\n",tmp); int j=1; while(++j){ for(maxi=-1,max=tmp,i=0;i<n;i++){ if(max<cal[i]){ max=cal[i]; maxi=i; } } if(maxi==-1)break; tmp=(tmp*(a+(j-2)*b)+cal[maxi]*b)/(a+(j-1)*b); printf("%f\n",tmp); cal[maxi]=0; } int d=tmp; printf("%d\n",tmp); return 0; }
main.c: In function 'main': main.c:31:5: error: conflicting types for 'd'; have 'int' 31 | int d=tmp; | ^ main.c:4:17: note: previous declaration of 'd' with type 'int[100]' 4 | int n,a,b,c,d[100]; | ^
s032440000
p00490
C
#include<stdio.h> int main(){ int n,a,b,c,d[100]; int i,maxi; double max,cal[100],tmp; scanf("%d%d%d%d",&n,&a,&b,&c); for(i=0;i<n;i++){ scanf("%d",&d[i]); cal[i]=(double)d[i]/(double)b; } tmp=(double)c/(double)a; int j=1; while(++j){ for(maxi=-1,max=tmp,i=0;i<n;i++){ if(max<cal[i]){ max=cal[i]; maxi=i; } } if(maxi==-1)break; tmp=(tmp*(a+(j-2)*b)+cal[maxi]*b)/(a+(j-1)*b); cal[maxi]=0; } printf("%.0f\n",tmp-0.5; return 0; }
main.c: In function 'main': main.c:28:28: error: expected ')' before ';' token 28 | printf("%.0f\n",tmp-0.5; | ~ ^ | ) main.c:29:14: error: expected ';' before '}' token 29 | return 0; | ^ | ; 30 | } | ~
s834534586
p00490
C
#include<stdio.h> int main(void) { int box,n,t[101]={0},y=0,a,b,cnt2,cnt; scanf("%d %d %d %d",&n,&a,&b,&t[0]); for(cnt=1;cnt<=n;cnt++){ scanf("%d",&t[cnt]); } for(cnt=1;cnt<=n;cnt++){ for(cnt2=1;cnt2<=n;cnt2++){ if(t[cnt2]<t[cnt+1]){ box=t[cnt2]; t[cnt2]=t[cnt2+1]; t[cnt2+1]=box; } } } cnt2=0; for(cnt=1;cnt<n;cnt++){ y+=t[cnt]; cnt2++; if(max<(y+t[0])/(a+cnt2*b)){ max=(y+t[0])/(a+cnt2*b); } } printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:22:20: error: 'max' undeclared (first use in this function) 22 | if(max<(y+t[0])/(a+cnt2*b)){ | ^~~ main.c:22:20: note: each undeclared identifier is reported only once for each function it appears in
s278565771
p00490
C
#include<stdio.h> int main(void) { int box,n,t[101]={0},y=0,a,b,cnt2,cnt; scanf("%d %d %d %d",&n,&a,&b,&t[0]); for(cnt=1;cnt<=n;cnt++){ scanf("%d",&t[cnt]); } for(cnt=1;cnt<=n;cnt++){ for(cnt2=1;cnt2<=n;cnt2++){ if(t[cnt2]<t[cnt+1]){ box=t[cnt2]; t[cnt2]=t[cnt2+1]; t[cnt2+1]=box; } } } cnt2=0; y=t[0]; for(cnt=1;cnt<n;cnt++){ y+=t[cnt]; cnt2++; if(max<y/(a+cnt2*b)){ max=y/(a+cnt2*b); } } printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:23:20: error: 'max' undeclared (first use in this function) 23 | if(max<y/(a+cnt2*b)){ | ^~~ main.c:23:20: note: each undeclared identifier is reported only once for each function it appears in
s230304225
p00490
C
#include <stdio.h> int main() { int n, kp, tp, kc, tc[101]; int dc[101]; scanf("%d%d%d%d", &n,&kp,&tp,&kc); int ,sumc=kc,sump=kp,i,j,temp; for (i = 0;i < n;i++) { scanf("%d", &tc[i]); } for (i = 0;i < n;i++) { for (j = n - 1;j > i;j--) { if (tc[j - i] < tc[j]) tmp = tc[j]; tc[j] = tc[j - 1]; tc[j - 1] = tmp; } } for (i = 0;i < n;i++) { if (tc[i] / tp > kc / kp) { sump += 2;sumc += tc[i]; dc[i] = sumc / sump; if (dc[i] < dc[i - 1])printf("%d\n", dc[i]);break; } else printf("%d\n", kc / kp);break; } return 0; }
main.c: In function 'main': main.c:8:13: error: expected identifier or '(' before ',' token 8 | int ,sumc=kc,sump=kp,i,j,temp; | ^ main.c:9:14: error: 'i' undeclared (first use in this function) 9 | for (i = 0;i < n;i++) { | ^ main.c:9:14: note: each undeclared identifier is reported only once for each function it appears in main.c:13:22: error: 'j' undeclared (first use in this function) 13 | for (j = n - 1;j > i;j--) { | ^ main.c:15:33: error: 'tmp' undeclared (first use in this function); did you mean 'tp'? 15 | tmp = tc[j]; | ^~~ | tp main.c:22:25: error: 'sump' undeclared (first use in this function) 22 | sump += 2;sumc += tc[i]; | ^~~~ main.c:22:35: error: 'sumc' undeclared (first use in this function) 22 | sump += 2;sumc += tc[i]; | ^~~~
s722395721
p00490
C
#include <stdio.h> int main() { int n, kp, tp, kc, tc[101]; int dc[101]; scanf("%d%d%d%d", &n,&kp,&tp,&kc); int sumc=kc,sump=kp,i,j,temp; for (i = 0;i < n;i++) { scanf("%d", &tc[i]); } for (i = 0;i < n;i++) { for (j = n - 1;j > i;j--) { if (tc[j - i] < tc[j]) tmp = tc[j]; tc[j] = tc[j - 1]; tc[j - 1] = tmp; } } for (i = 0;i < n;i++) { if (tc[i] / tp > kc / kp) { sump += 2;sumc += tc[i]; dc[i] = sumc / sump; if (dc[i] < dc[i - 1])printf("%d\n", dc[i]);break; } else printf("%d\n", kc / kp);break; } return 0; }
main.c: In function 'main': main.c:15:33: error: 'tmp' undeclared (first use in this function); did you mean 'temp'? 15 | tmp = tc[j]; | ^~~ | temp main.c:15:33: note: each undeclared identifier is reported only once for each function it appears in
s219344127
p00490
C
include <stdio.h> int main() { int n, kp, tp, kc, tc[101]; int dc[101]; scanf("%d%d%d%d", &n,&kp,&tp,&kc); int sumc=kc,sump=kp,i,j,tmp; for (i = 0;i < n;i++) { scanf("%d", &tc[i]); } for (i = 0;i < n;i++) { for (j = n - 1;j > i;j--) { if (tc[j - i] < tc[j]) tmp = tc[j]; tc[j] = tc[j - 1]; tc[j - 1] = tmp; } } for (i = 0;i < n;i++) { if (tc[i] / tp > kc / kp) { sump += 2;sumc += tc[i]; dc[i] = sumc / sump; if (dc[i] < dc[i - 1])printf("%d\n", dc[i]);break; } else printf("%d\n", kc / kp);break; } return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^
s301716720
p00490
C
#include <stdio.h> #include <stdlib.h> void bubble_sort(int *x, int n) { int i, j, temp; for (i = 0; i < n - 1; i++) { for (j = n - 1; j > i; j--) { if (x[j - 1] < x[j]) { temp = x[j]; x[j] = x[j - 1]; x[j - 1]= temp; } } } } int main(void) { int n; int a, b; int kcal, tcal[100]; int sum; int ans; int i, j; scanf("%d", &n); scanf("%d%d", &a, &b); scanf("%d", &kcal); for (i = 0; i < n; i++){ scanf("%d", &tcal[i]); } bubble_sort(tcal, n); ans = 0; for (i = 0; i < n; i++){ sum = kcal; for (j = 0; j < i; j++){ sum += tcal[j]; } ans = max(ans, sum / (a + b * i)); } printf("%d\n", ans); return (0); }
main.c: In function 'main': main.c:45:23: error: implicit declaration of function 'max' [-Wimplicit-function-declaration] 45 | ans = max(ans, sum / (a + b * i)); | ^~~
s743893812
p00490
C
//情報オリンピック2011予選3「最高のピザ」 #include<stdio.h> int main(void) { int n, a, b, c, *ml, f1, f2, goukei, temp, max; scanf("%d",&n); scanf("%d %d",&a, &b); ml = new int [n]; scanf("%d",&c); for(f1 = 0; f1 < n; f1++) scanf("%d",&ml[f1]); //トッピング降順に並べ替え for(f1 = 0; f1 < n-1; f1++){ for(f2 = f1+1; f2 < n; f2++){ if(ml[f1] < ml[f2]){ temp = ml[f1]; ml[f1] = ml[f2]; ml[f2] = temp; } } } //トッピングを何も載せない時の1ドル当たりのカロリー数 max = c / a; for(f1 = 1; f1 <= n; f1++){ goukei = 0; //上からf1までのトッピングを抜き出す for(f2 = 0; f2 < f1; f2++) goukei += ml[f2]; //1ドル当たりのカロリー数を計算 goukei = (goukei + c) / (a + f1 * b); if(max < goukei) max = goukei; } printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:12:14: error: 'new' undeclared (first use in this function) 12 | ml = new int [n]; | ^~~ main.c:12:14: note: each undeclared identifier is reported only once for each function it appears in main.c:12:17: error: expected ';' before 'int' 12 | ml = new int [n]; | ^~~~ | ;
s971344577
p00490
C
#include <stdio.h> #include <algorithm> using namespace std; int main(){ int N,A,B,C,array[100],i,result = 0,kari; scanf("%d",&N); scanf("%d %d",&A,&B); scanf("%d",&C); for(i = 0;i < N;i++) scanf("%d",&array[i]); sort(array,array + N); reverse(array,array + N); for(i = 0;i < N;i++){ kari = C / (A + B * i); if(kari > result) result = kari; C+=array[i]; } printf("%d\n",result); return 0; }
main.c:2:10: fatal error: algorithm: No such file or directory 2 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s221255651
p00490
C++
#include<iostream> using namespace std; int main(){ int k,n,m,p,dat[15000],cnt; double ans=0; cin>>k>>n>>m>>p; for(int i=0;i<k;i++){ cin>>dat[i]; } sort(dat,dat+n,greater<int>()); ans=p/n; for(int i=0;i<k;i++){ cnt+=dat[i]; if((cnt+p)/(n+(i+1)*m)>ans){ ans=(cnt+p)/(n+(i+1)*m); } else{ break; } } cnt=ans; cout<<cnt<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(dat,dat+n,greater<int>()); | ^~~~ | short
s056304363
p00490
C++
#include<iostream> #include<algorithm> using namespace std; int func(int dt[],int num){ unsigned long long int c=num; unsigned long long int time=0; for(int i=0;i<c-1;i++){ time+=(c-(i+1))*dt[i]; } return time; } int main(){ int n; while(1){ cin>>n; if(n==0)break; unsigned long long int cost[n]; unsigned long long int ans=0; for(int i=0;i<n;i++){ cin>>cost[i]; } sort(cost,cost+n); ans=func(cost,n); cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:26: error: cannot convert 'long long unsigned int*' to 'int*' 25 | ans=func(cost,n); | ^~~~ | | | long long unsigned int* a.cc:5:14: note: initializing argument 1 of 'int func(int*, int)' 5 | int func(int dt[],int num){ | ~~~~^~~~
s318936777
p00490
C++
#include<bits/stdc++.h> using namespace std; int n,a,b,c,x[100],d,p; main(){ p=0; cin>>n; cin>>a>>b; cin>>c; for(int i=0;i<n;i++){ cin>>x[i]; } d=0; sort(x,x+n); p=c/a; for(int i=0;i<n;i++){ c += b; a += x[i]; p=max(p,k/m); } cout<<p<<endl; return 0; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:18:17: error: 'k' was not declared in this scope 18 | p=max(p,k/m); | ^ a.cc:18:19: error: 'm' was not declared in this scope 18 | p=max(p,k/m); | ^
s296290763
p00490
C++
<a href="http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0567">??????</a> #???????????? ?????¶??????????????????????????¶????????¶ #?§£??? ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? #?????? dp?????????????????£???????????¶???dp??§?????§???????????§dp??§?§£???????????? #????????? ```cpp #include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include <cmath> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) //??§?¬??????§?§£?????? int main(void){ int n, a, b; double kizi; cin >> n >> a >> b >> kizi; vector<int> debu(n + 1);//?????????????????\???????????? rep(i, n) cin >> debu[i]; sort(debu.begin(), debu.end()); reverse(debu.begin(), debu.end());//??§??????????????????????????? vector<double> ans(n + 1); //?????????????????????????????????????????????????????§?????? rep(i, n + 1){//i????????????????????°????????¶??¨??? double nedan = (double)a + (double)i * (double)b;//??????????¨???? double karori = kizi;//?????°?????????????????????????????¨?????? rep(j, i) karori += debu[j];//i????????????????????°????????????????????????????????????????????????i???????????§?????? ans[i] = karori / nedan;//???????????\???????????? } sort(ans.begin(), ans.end()); reverse(ans.begin(), ans.end()); printf("%d\n", (int)floor(ans[0]));//????????§????????????????????? return 0; } ```
a.cc:1:77: warning: trigraph ??< ignored, use -trigraphs to enable [-Wtrigraphs] 1 | <a href="http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0567">??????</a> a.cc:2:2: error: invalid preprocessing directive #? 2 | #???????????? | ^ a.cc:3:6: error: extended character ¶ is not valid in an identifier 3 | ?????¶??????????????????????????¶????????¶ | ^ a.cc:3:33: error: extended character ¶ is not valid in an identifier 3 | ?????¶??????????????????????????¶????????¶ | ^ a.cc:3:42: error: extended character ¶ is not valid in an identifier 3 | ?????¶??????????????????????????¶????????¶ | ^ a.cc:5:2: error: invalid preprocessing directive #? 5 | #?§£??? | ^ a.cc:5:3: error: extended character § is not valid in an identifier 5 | #?§£??? | ^ a.cc:5:3: error: extended character £ is not valid in an identifier a.cc:6:18: error: extended character § is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:20: error: extended character ¬ is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:27: error: extended character § is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:29: error: extended character § is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:29: error: extended character £ is not valid in an identifier a.cc:6:69: error: extended character ° is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:108: error: extended character § is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:132: error: extended character ° is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:153: error: extended character § is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:183: error: extended character ° is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:240: error: extended character § is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? | ^ a.cc:6:249: error: extended character ° is not valid in an identifier 6 | ?????????????????§?¬??????§?§£??????????????????????????????????????°??????????????????????????????????????§???????????????????????°????????????????????§?????????????????????????????°????????????????????????????????????????????????????????§????????°??????????????¨?????????????????????????????°????????¶?????????????§£?????????????????????????????§??????????????¨??¢?´¢????????°???????????????????????°????????¶??°???0~n?????¨????????????????????????????????????????????????????????§??????????????´?????????????????????/??????????¨??????????????????§???????????????????????¨????????????????????°????????? |
s926990976
p00490
C++
\#include <cstdio> #include <vector> #include <algorithm> using namespace std; int n; int a, b; int c; vector<int> d; int main(){ scanf("%d %d %d %d", &n, &a, &b, &c); for(int i=0; i<n; i++){ int t; scanf("%d", &t); d.push_back(t); } sort(d.rbegin(), d.rend()); printf("%d %d %d %d\n", n, a, b, c); for(int i=0; i<n; i++) printf("%d ", d[i]); printf("\n"); int ans = 0; for(int i=0; i<n+1; i++){ int cal; cal = c; for(int j=0; j<i; j++) cal += d[j]; cal /= a + b * i; if(ans <= cal) ans = cal; else break; } printf("%d\n", ans); return 0; }
a.cc:1:1: error: stray '\' in program 1 | \#include <cstdio> | ^ a.cc:1:2: error: stray '#' in program 1 | \#include <cstdio> | ^ a.cc:1:3: error: 'include' does not name a type 1 | \#include <cstdio> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /
s793219195
p00490
C++
#include<stdio.h> int main(void) { int n,a,b,c; int cal[10000]={0}; int i,j; int x,z; int rui=0,masa = 0; scanf("%d%d%d%d",&n,&a,&b,&c); for(i = 0;i < n; i++) scanf("%d",&cal[i]); for(i = 0;i < n; i++){ for(j = 0;j < n; j++){ if(cal[i] > cal[j]){ x = cal[i]; cal[i] = cal[j]; cal[j] = x; } } } z = c; rui = c/a; for(i = 1;i <= n; i++){ z += cal[i-1]; amsa = z / ((b*i)+a); if(rui <=masa){ rui = masa; } else{ break; } } printf("%d\n",rui); return 0; }
a.cc: In function 'int main()': a.cc:26:9: error: 'amsa' was not declared in this scope; did you mean 'masa'? 26 | amsa = z / ((b*i)+a); | ^~~~ | masa
s790435533
p00490
C++
/** * pizza.cpp * Authorl: Tatsuro Ide * Date: 2/7/2017 * Desc: Competitive Programming AOJ0567 */ #include <iostream> #include <vector> #include <algorithm> #include <functional> using namespace std; int main() { int number_of_toppings, crust_price, topping_price, crust_calories; vector<int> topping_calories; // get inputs. cin >> number_of_toppings; cin >> crust_price; cin >> topping_price; cin >> crust_calories; // allocate memory. topping_calories.resize(number_of_toppings); // store the toppings' calories. for(int i = 0; i < number_of_toppings; ++i) { cin >> topping_calories[i]; } // sort the calories (descending order). sort(topping_calories.begin(), topping_calories.end(), greater<int>()); int total_calories = crust_calories; int total_price = crust_price; int calories_per_dollar; for(int i = 0; i < number_of_toppings; ++i) { total_calories += topping_calories; total_price += topping_price; if( calories_per_dollar > (total_calories / total_price) ) { break; } else { calories_per_dollar = total_calories / total_price; } } cout << calories_per_dollar; return 0; }
a.cc: In function 'int main()': a.cc:44:32: error: no match for 'operator+=' (operand types are 'int' and 'std::vector<int>') 44 | total_calories += topping_calories; | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
s715993291
p00490
C++
#include <iostream> #include <vector> #include <stack> using namespace std; struct Node { int no_; int calorie_; int price_; Node(int n, int c, int p) : no_(n), calorie_(c), price_(p) {} }; int N, A, B, C; vector<int> calorie; int calcBestPizza() { int ans = 0; stack<Node> st; st.push(Node(0, C, A)); st.push(Node(0, calorie[0]+C, A+B)); while(!st.empty()) { auto node = st.top(); st.pop(); int n = node.no_; int total_calorie = node.calorie_; int total_price = node.price_; int tmp = total_calorie / total_price; if ( tmp > ans ) { ans = tmp; } if (n < N - 1) { st.push(Node(n+1, total_calorie, total_price)); st.push(Node(n+1, total_calorie + calorie[n+1], total_price+B)); } } return ans; } int main(int argc, char const *argv[]) { cin>>N; cin>>A>>B; cin>>C; for (int i = 0; i < N; ++i) { int c; cin>>c; calorie.push_back(c); } sort(calorie.begin(), calorie.end(), greater<int>()); int total_calorie = C; int total_price = A; int ans = C / A; for (int i = 0; i < N; ++i) { total_calorie += calorie[i]; total_price += B; ans = max(ans, total_calorie/total_price); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:59:5: error: 'sort' was not declared in this scope; did you mean 'short'? 59 | sort(calorie.begin(), calorie.end(), greater<int>()); | ^~~~ | short
s230270435
p00490
C++
#include <iostream> #include <vector> #include <stack> using namespace std; struct Node { int no_; int calorie_; int price_; Node(int n, int c, int p) : no_(n), calorie_(c), price_(p) {} }; int N, A, B, C; vector<int> calorie; int calcBestPizza() { int ans = 0; stack<Node> st; st.push(Node(0, C, A)); st.push(Node(0, calorie[0]+C, A+B)); while(!st.empty()) { auto node = st.top(); st.pop(); int n = node.no_; int total_calorie = node.calorie_; int total_price = node.price_; int tmp = total_calorie / total_price; if ( tmp > ans ) { ans = tmp; } if (n < N - 1) { st.push(Node(n+1, total_calorie, total_price)); st.push(Node(n+1, total_calorie + calorie[n+1], total_price+B)); } } return ans; } int main(int argc, char const *argv[]) { cin>>N; cin>>A>>B; cin>>C; for (int i = 0; i < N; ++i) { int c; cin>>c; calorie.push_back(c); } sort(calorie.begin(), calorie.end(), greater<int>()); int total_calorie = C; int total_price = A; int ans = C / A; for (int i = 0; i < N; ++i) { total_calorie += calorie[i]; total_price += B; ans = max(ans, total_calorie/total_price); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:59:5: error: 'sort' was not declared in this scope; did you mean 'short'? 59 | sort(calorie.begin(), calorie.end(), greater<int>()); | ^~~~ | short
s580079731
p00490
C++
#include <iostream> #include <vector> #include <iostream> using namespace std; int main(){ int n; while(cin >> n){ int a,b, k_a; vector<int> v(n); cin >> a >> b; cin >> k_a; for(int i=0;i<n;i++) cin >> v[i]; sort(v.begin(),v.end()); int ans = k_a / a, sum = 0; for(int i=1;i<=n;i++){ sum += v[n-i]; ans = max(ans,(k_a+sum)/(a+i*b)); } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(v.begin(),v.end()); | ^~~~ | short
s357415553
p00490
C++
#include<iostream> #include<algorithm> using namespace std; const int MAX_B = 1001; typedef struct{ int price; int cal; }Top; int numtop,price; int maxave = 0; Top base; int item[MAX_B]; void solve(int num,Top T){ if(T.cal/T.price > maxave) maxave = T.cal/T.price; for(int i = num+1; i <= numtop; i++){ Top next = T; next.price += price; next.price += item[i]; solve(i,next); solve(i,T); } cout << now.cal << " " << now.price << endl; return (int)(now.cal/now.price); } int main(){ cin >> numtop; cin >> base.price >> price; cin >> base.cal; for(int i = 1; i <= numtop; i++){ cin >> item[i]; } solve(0,base); cout << maxave << endl; return 0; }
a.cc: In function 'void solve(int, Top)': a.cc:27:11: error: 'now' was not declared in this scope 27 | cout << now.cal << " " << now.price << endl; | ^~~
s234675784
p00490
C++
#include <iostream> #include <fstream> using namespace std; int a, b, c, d[100], n; //iツ氾板姪堋づ個トツッツピツδ督グツづーツ使ツつ、(f=true)/ツ使ツづュツづ按つ「(f=false)ツづつォ1ツドツδ仰督鳴つスツづィツづ個カツδ債δ環ーツ青板づーツ陛板つキ(kツづ債つサツづェツづ慊づづ個カツδ債δ環ーツづ個和,mツづ債つサツづェツづ慊づづ個値ツ段ツづ個和) double dfs(int i, int m, int k, bool f) { if (i == n-1) { if (f) return ((double)k+(double)d[i])/((double)m+(double)b); else return (double)k/(double)m; } if (f) return (double)max(dfs(i+1, m+b, k+d[i], true), dfs(i+1, m+b, k+d[i], false)); else return (double)max(dfs(i+1, m, k, true), dfs(i+1, m, k, false)); } int main() { int i; ifstream cin(argv[1]); cin >> n >> a >> b >> c; for (i = 0; i < n; i++) cin >> d[i]; cout << (int)max(dfs(0, a, c, true), dfs(0, a, c, false)) << endl; }
a.cc: In function 'int main()': a.cc:23:22: error: 'argv' was not declared in this scope 23 | ifstream cin(argv[1]); | ^~~~
s780154738
p00490
C++
#include <iostream> #include <queue> #include <vector> #include<algorithm> using namespace std; int maxn; int kv,tv; int kc; vector<int> tc; int dp[101][101]; int main(void) { cin >> maxn; cin >> kv >> tv; cin >> kc; for(int i=0;i<maxn;++i){ int a; cin >> a; tc.push_back(a); } memset(dp,-1,sizeof(dp)); dp[0][0] = 0; for(int t=0;t<tc.size();++t)//なにをトッピングする? { for(int i=0;i<101;++i){ int now = t; if(dp[now][i] == -1) continue; if(dp[now+1][i] < dp[now][i]) dp[now+1][i] = dp[now][i]; if(dp[now+1][i+1] < dp[now][i]+tc[t]) dp[now+1][i+1] = dp[now][i]+tc[t]; } } double max=-1; int d = tc.size(); for(int i=0;i<101;++i){ if(max < (double)(kc+dp[d][i])/(double)(i*tv+kv)) max = (double)(kc+dp[d][i])/(double)(i*tv+kv); } cout << (int)max << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:9: error: 'memset' was not declared in this scope 23 | memset(dp,-1,sizeof(dp)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<algorithm> +++ |+#include <cstring> 5 | using namespace std;
s213896780
p00490
C++
#include <cstdio> #include <algorithm> #include <vector> using namespace std; int n,a,b,c,p;//pはピザの値段/カロリー vector<int> cal; int main(){ scanf("%d",&n); scanf("%d %d",&a,&b); scanf("%d",&c); for(int j=0;j<n;j++) scanf("%d",&cal[j]); sort( cal.begin(), cal.end() ); float max=c/a; //値段当たりのカロリー for(int k=0;k<n;k++){ int t=0; for(int l=0;l<k;l++) t=+cal[l]; p=(c+t)/(a+k*b); if(p>max) max=p; } double bp = floor(max); printf("%f",bp); return 0; }
a.cc: In function 'int main()': a.cc:24:21: error: 'floor' was not declared in this scope 24 | double bp = floor(max); | ^~~~~
s349790592
p00490
C++
#include "iostream" int main(){ int n; int primes[2]; int pizaKarori; int toppings[100]; int masterK; int masterP; cin >> n; cin >> primes[0] ; cin >> primes[1] ; cin >> pizaKarori; masterK=pizaKarori; masterP=primes[0]; for(int i=0;i<n;i++){ cin >> toppings[i]; } for(int j=0;j<n;j++){ for(int i=0;i<=n;i++){ if(toppings[i]<toppings[i+1]){ int c; c=toppings[i]; toppings[i]=toppings[i+1]; toppings[i+1]=c; } } } for(int i=0;i<n;i++){ if((double)(masterK)/masterP < (double)(masterK+toppings[i])/masterP+primes[2]){ masterK+=toppings[i]; masterP+=primes[2]; } else{ break; } } cout << masterK/masterP <<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 10 | cin >> n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:40:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 40 | cout << masterK/masterP <<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:40:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 40 | cout << masterK/masterP <<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s968784076
p00490
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int f(int x,int y){ if(x<y)return false; return true; } int main(){ int n,a,b,c,d,ans[3]; vector<int> vi; scanf("%d%d%d%d",&n,&a,&b,&c); for(int i=0;i<n;i++){ scanf("%d",&d); vi.push_back(d); } sort(vi.begin(),vi.end(),f); ans[0]=c/a; ans[1]=(c+d[0])/(a+b); ans[2]=(c+d[0]+d[1])/(a+b+b); printf("%d\n",max(ans[0],max(ans[1],ans[2]))); }
a.cc: In function 'int main()': a.cc:21:20: error: invalid types 'int[int]' for array subscript 21 | ans[1]=(c+d[0])/(a+b); | ^ a.cc:22:20: error: invalid types 'int[int]' for array subscript 22 | ans[2]=(c+d[0]+d[1])/(a+b+b); | ^ a.cc:22:25: error: invalid types 'int[int]' for array subscript 22 | ans[2]=(c+d[0]+d[1])/(a+b+b); | ^
s314953737
p00490
C++
#include<algorithm> #include<functional> using namespace std; int main() { int i, n, a, b, c, d[10000],g,max; scanf("%d", &n); scanf("%d %d", &a, &b); scanf("%d", &c); for (i = 0; i < n; i++){ scanf("%d", &d[i]); } sort(d, d + n, greater<int>()); max = c / a; for (i = 1; i <= n; i++){ g = 0; for (int i2 = 0; i2 < i; i2++){ g += d[i2]; } g = (g + c) / (a + i*b); if (max < g) max = g; } printf("%d\n", max); return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'scanf' was not declared in this scope 7 | scanf("%d", &n); | ^~~~~ a.cc:25:9: error: 'printf' was not declared in this scope 25 | printf("%d\n", max); | ^~~~~~ a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 2 | #include<functional> +++ |+#include <cstdio> 3 | using namespace std;
s148229625
p00490
C++
/* title: Best Pizza * source: JOI2011-2012 Yosen No.3 * hint: * トッピングをx個使用すると仮定した場合、 * そのx個はカロリーが大きい方からx個選んだものが最適になる */ #include <iostream> #include <numeric> // accumulateを使うため #include <vector> using namespace std; int main() { int N, A, B, C; cin >> N >> A >> B >> C; vector<int> toppings(N); for(int i = 0; i < N; i++) cin >> toppings[i]; sort(toppings.begin(), toppings.end(), greater<int>()); int best = 0; for(int x = 0; x <= N; x++) { int calory = C + accumulate(toppings.begin(), toppings.begin() + x, 0); int cost = A + B * x; best = max(best, calory / cost); } cout << best << endl; }
a.cc: In function 'int main()': a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(toppings.begin(), toppings.end(), greater<int>()); | ^~~~ | short
s551625541
p00491
Java
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N=sc.nextInt(); int K=sc.nextInt(); int[][] curr =new int[3][2]; int[][] next =new int[3][2]; for(int i=0; i<3; i++) curr[i][0]=1; int[] dayPlan=new int[N]; for(int i=0; i<K; i++) dayPlan[sc.nextInt()-1] = sc.nextInt(); for(int i=0; i<N-1; i++) { if(dayPlan[i] != 0) { for(int j=0; j<3; j++) { if(j != dayPlan[i]-1) { curr[j][0] = 0; curr[j][1] = 0; } } } for(int j=0; j<3; j++) { for(int k=0; k<3; k++) if(j==k){ next[k][1]+=curr[j][0]; next[k][1]%=10000; } else { next[k][0]+=curr[j][0]; next[k][0]%=10000; } for(int k=0; k<3; k++) if(j!=k){ next[k][0]+=curr[j][1]; next[k][0]%=10000; } } for(int j=0; j<3; j++) { curr[j][0]=next[j][0]; curr[j][1]=next[j][1]; next[j][0]=0; next[j][1]=0; } } int ans = 0; for(int i=0; i<3; i++)ans+=curr[i][0]; for(int i=0; i<3; i++)ans+=curr[i][1]; ans %= 10000; System.out.println(ans); } }
Main.java:5: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:5: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s132033250
p00491
Java
import java.util.*; public class AOJ0568 { static int cnt=0; static int n; static int bfs(int a,int b,int day){ int cnt=0; if(day==n+1){//もしたどり着けたら1を返す。 return 1; } if(m[day][a][b]>-1)return m[day][a][b];//メモしていたらそれを返す。 if(hyou[day]>0){//指定してある場合 if(hyou[day]==a&&a==b){//全部一緒だったら0を返す。 return 0; }else{ return bfs(b,hyou[day],day+1)%10000;//違ったら日にち足して次の日に再帰。 } } for(int i=1;i<=3;i++){ if(a==i&&b==a)continue; cnt+=bfs(b,i,day+1)%10000; } m[day][a][b]=cnt%10000; return cnt%10000; } static int m[][][]=new int[101][4][4]; static int hyou[]=new int[101]; public static void main(String[] args) { Scanner in = new Scanner(System.in); n = in.nextInt(); int k = in.nextInt(); for(int s=0;s<101;s++){ hyou[s]=0; for(int i=0;i<4;i++){ for(int z=0;z<4;z++)m[s][i][z]=-1; } } for(int i=0;i<k;i++){ int w = in.nextInt(); hyou[w]=in.nextInt(); } int ans = bfs(0,0,1); System.out.println(ans); } }
Main.java:2: error: class AOJ0568 is public, should be declared in a file named AOJ0568.java public class AOJ0568 { ^ 1 error
s524194492
p00491
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { int N,K; Scanner sc = new Scanner(System.in); N=sc.nextInt();//何日間の予定を考えるか K=sc.nextInt();//何日間の予定が決まっているか int pasta[][]=new int[6][N+1]; int pastaplan[]=new int[N+1]; for(int i=0;i<K;i++){ int day=sc.nextInt();//何日の予定が決まっているか pastaplan[day]=sc.nextInt();//その日のパスタは何か } if(pastaplan[1]==0){//もし1日目の予定が決まっていなければ pasta[1][1]=1;pasta[3][1]=1;pasta[5][1]=1; }else if(pastaplan[1]==1){ pasta[1][1]=1; }else if(pastaplan[1]==2){ pasta[3][1]=1; }else if(pastaplan[1]==3){ pasta[5][1]=1; } for(int j=2;j<=N;j++){ if(pastaplan[j]==0){//j日の予定がきまってなければ pasta[0][j]=pasta[1][j-1];//2日連続の時には前日の1日目の値がそのままくる。 pasta[2][j]=pasta[3][j-1]; pasta[4][j]=pasta[5][j-1]; pasta[1][j]=pasta[2][j-1]+pasta[3][j-1]+pasta[4][j-1]+pasta[5][j-1]; pasta[3][j]=pasta[0][j-1]+pasta[1][j-1]+pasta[4][j-1]+pasta[5][j-1]; pasta[5][j]=pasta[0][j-1]+pasta[1][j-1]+pasta[2][j-1]+pasta[3][j-1]; }else if(pastaplan[j]==1){//j日の予定がトマトだったら pasta[0][j]=pasta[1][j-1];//2日連続の時には前日の1日目の値がそのままくる。 pasta[1][j]=pasta[2][j-1]+pasta[3][j-1]+pasta[4][j-1]+pasta[5][j-1]; }else if(pastaplan[j]==2){ pasta[2][j]=pasta[3][j-1]; pasta[3][j]=pasta[0][j-1]+pasta[1][j-1]+pasta[4][j-1]+pasta[5][j-1]; }else{ pasta[4][j]=pasta[5][j-1]; pasta[5][j]=pasta[0][j-1]+pasta[1][j-1]+pasta[2][j-1]+pasta[3][j-1]; } } int sum=pasta[0][N]+pasta[1][N]+pasta[2][N]+pasta[3][N]+pasta[4][N]+pasta[5][N]; System.out.println(sum%10000); }
Main.java:46: error: reached end of file while parsing } ^ 1 error
s482994828
p00491
Java
import java.util.Scanner; public class AOJ0568 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(),K = sc.nextInt(); long[][] NK = new long[N][6]; int[] dp = new int[N]; for(int i = 0; i < N; i++) dp[i] = 0; for(int i = 0; i < K; i++){ int scan = sc.nextInt(); dp[scan-1] = sc.nextInt(); } for(int i = 0; i < N; i++){ if(dp[i] == 1){ if(i == 0)NK[i][1] = 1; else{ NK[i][0] += NK[i-1][1]; NK[i][1] += NK[i-1][2] + NK[i-1][3] + NK[i-1][4] + NK[i-1][5]; } } else if(dp[i] == 2){ if(i == 0)NK[i][3] = 1; else{ NK[i][2] += NK[i-1][3]; NK[i][3] += NK[i-1][0] + NK[i-1][1] + NK[i-1][4] + NK[i-1][5]; } } else if(dp[i] == 3){ if(i == 0)NK[i][5] = 1; else{ NK[i][4] += NK[i-1][5]; NK[i][5] += NK[i-1][0] + NK[i-1][1] + NK[i-1][2] + NK[i-1][3]; } } else{ if(i == 0){ NK[i][1] = 1;NK[i][3] = 1;NK[i][5] = 1; } else{ if(NK[i-1][1] > 0){ NK[i][0] += NK[i-1][1] % 10000; NK[i][3] += NK[i-1][0] + NK[i-1][1] % 10000; NK[i][5] += NK[i-1][0] + NK[i-1][1] % 10000; }else{ NK[i][3] += NK[i-1][0] + NK[i-1][1] % 10000; NK[i][5] += NK[i-1][0] + NK[i-1][1] % 10000; } if(NK[i-1][3] > 0){ NK[i][1] += NK[i-1][2] + NK[i-1][3] % 10000; NK[i][2] += NK[i-1][3] % 10000; NK[i][5] += NK[i-1][2] + NK[i-1][3] % 10000; }else{ NK[i][1] += NK[i-1][2] + NK[i-1][3] % 10000; NK[i][5] += NK[i-1][2] + NK[i-1][3] % 10000; } if(NK[i-1][5] > 0){ NK[i][1] += NK[i-1][4] + NK[i-1][5] % 10000; NK[i][3] += NK[i-1][4] + NK[i-1][5] % 10000; NK[i][4] += NK[i-1][5] % 10000; }else{ NK[i][1] += NK[i-1][4] + NK[i-1][5] % 10000; NK[i][3] += NK[i-1][4] + NK[i-1][5] % 10000; } } } } int total = 0; for(int j = 0; j < 6; j++){ total += NK[N-1][j]; } System.out.println(total % 10000); } }
Main.java:3: error: class AOJ0568 is public, should be declared in a file named AOJ0568.java public class AOJ0568 { ^ 1 error
s642901150
p00491
Java
import java.util.Scanner; public class aoj0568 { public static void main(String[] args){ Scanner in = new Scanner(System.in); int allday = in.nextInt(); int pasta = in.nextInt(); int sum = 0; int[][]A = new int [3][2]; int[]B = new int [3]; int[]C = new int [allday+1]; for(int i = 1;i <= allday;i++)C[i] = 0; for(int i = 0;i < pasta;i++){ int day = in.nextInt(); C[day] = in.nextInt(); } for(int i = 0;i < 3;i++)A[i][0]=1; switch(C[1] % 4){ case 0: break; case 1: A[1][0] = 0; A[2][0] = 0; break; case 2: A[0][0] = 0; A[2][0] = 0; break; case 3: A[0][0] = 0; A[1][0] = 0; break; } for(int i = 2;i <= allday;i++){ B[0]=A[1][0]+A[2][0]+A[1][1]+A[2][1]; B[1]=A[0][0]+A[2][0]+A[0][1]+A[2][1]; B[2]=A[0][0]+A[1][0]+A[0][1]+A[1][1]; switch(C[i] % 4){ case 0: for(int j = 0;j < 3;j++){ A[j][1]=A[j][0] % 10000; A[j][0]=B[j] % 10000; } break; case 1: for(int j = 0;j < 3;j++){ A[j][1]=A[j][0] % 10000; A[j][0]=B[j] % 10000; if(j != 0){ A[j][0] = 0; A[j][1] = 0; } } break; case 2: for(int j = 0;j < 3;j++){ A[j][1]=A[j][0] % 10000; A[j][0]=B[j] % 10000; if(j != 1){ A[j][0] = 0; A[j][1] = 0; } } break; case 3: for(int j = 0;j < 3;j++){ A[j][1]=A[j][0] % 10000; A[j][0]=B[j] % 10000; if(j != 2){ A[j][0] = 0; A[j][1] = 0; } } } } for(int i = 0;i < 3;i++){ sum = sum + A[i][0] + A[i][1]; } sum = sum % 10000; System.out.println(sum); } }
Main.java:3: error: class aoj0568 is public, should be declared in a file named aoj0568.java public class aoj0568 { ^ 1 error
s857272694
p00491
C
#include<cstdio> #include<algorithm> #include<iostream> #include<functional> using namespace std; long long int dp[101][4][4]; int main(void) { int i,j,k,n,m,a,b[101],c; long long int sum,x; cin>>n>>m; for(i=1;i<=n;i++){ for(j=1;j<=3;j++){ for(k=0;k<=3;k++) dp[i][j][k]=0; } } for(i=1;i<=n;i++) b[i]=0; for(i=1;i<=m;i++){ cin>>a; cin>>b[a]; } if(b[1]>0) dp[1][b[1]][0]=1; else{ for(i=1;i<=3;i++) dp[1][i][0]=1; } for(i=1;i<n;i++){ for(j=1;j<=3;j++){ if(dp[i][j][0]+dp[i][j][1]+dp[i][j][2]+dp[i][j][3]>0){ for(k=0;k<=3;k++){ if(b[i+1]>0){ if(b[i+1]!=k||b[i+1]!=j){ dp[i+1][b[i+1]][j]+=dp[i][j][k]; dp[i+1][b[i+1]][j]%=10000; } } else{ if(k!=1||j!=1){ dp[i+1][1][j]+=dp[i][j][k]; dp[i+1][1][j]%=10000; } if(k!=2||j!=2){ dp[i+1][2][j]+=dp[i][j][k]; dp[i+1][2][j]%=10000; } if(k!=3||j!=3){ dp[i+1][3][j]+=dp[i][j][k]; dp[i+1][3][j]%=10000; } } } } } } sum=0; for(i=1;i<=3;i++){ for(j=0;j<=3;j++) sum+=dp[n][i][j]; } x=sum%10000; cout<<x<<endl; return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s760018782
p00491
C
#include<cstdio> #include<algorithm> #include<iostream> #include<functional> using namespace std; long long int dp[101][4][4]; int main(void) { int i,j,k,l,n,m,a,b[101],c; long long int sum,x; cin>>n>>m; for(i=1;i<=n;i++){ for(j=1;j<=3;j++){ for(k=0;k<=3;k++) dp[i][j][k]=0; } } for(i=1;i<=n;i++) b[i]=0; for(i=1;i<=m;i++){ cin>>a; cin>>b[a]; } if(b[1]>0) dp[1][b[1]][0]=1; else{ for(i=1;i<=3;i++) dp[1][i][0]=1; } for(i=1;i<n;i++){ for(j=1;j<=3;j++){ if(dp[i][j][0]+dp[i][j][1]+dp[i][j][2]+dp[i][j][3]>0){ for(k=0;k<=3;k++){ if(b[i+1]>0){ if(b[i+1]!=k||b[i+1]!=j){ dp[i+1][b[i+1]][j]+=dp[i][j][k]; dp[i+1][b[i+1]][j]%=10000; } } else{ for(l=1;l<=3;l++){ if(k!=l||j!=l){ dp[i+1][l][j]+=dp[i][j][k]; dp[i+1][l][j]%=10000; } } } } } } } sum=0; for(i=1;i<=3;i++){ for(j=0;j<=3;j++) sum+=dp[n][i][j]; } x=sum%10000; cout<<x<<endl; return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s196817090
p00491
C
#include<stdio.h> int main(void) { int
main.c: In function 'main': main.c:4:1: error: expected identifier or '(' at end of input 4 | int | ^~~ main.c:4:1: error: expected declaration or statement at end of input
s044036780
p00491
C
oppppppp
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input 1 | oppppppp | ^~~~~~~~
s233357472
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0} scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } a=0; for(i=0;i<9;i++){ a=a+d[i][n]; prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:5:1: error: expected ',' or ';' before 'scanf' 5 | scanf("%d %d",&n,&m); | ^~~~~ main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:31:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 31 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^ main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input
s338025895
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0} scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } a=0; for(i=0;i<9;i++){ a=a+d[i][n]; prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:5:1: error: expected ',' or ';' before 'scanf' 5 | scanf("%d %d",&n,&m); | ^~~~~ main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:31:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 31 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^ main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input
s679907220
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0} scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } a=0; for(i=0;i<9;i++){ a=a+d[i][n]; prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:5:1: error: expected ',' or ';' before 'scanf' 5 | scanf("%d %d",&n,&m); | ^~~~~ main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:31:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 31 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^ main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input
s559048121
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0} scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } a=0; for(i=0;i<9;i++){ a=a+d[i][n]; prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:5:1: error: expected ',' or ';' before 'scanf' 5 | scanf("%d %d",&n,&m); | ^~~~~ main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:31:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 31 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^ main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input
s819862697
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0}; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]=d[j][i]+d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } a=0; for(i=0;i<9;i++){ a=a+d[i][n]; prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:23:26: error: lvalue required as left operand of assignment 23 | d[j][i]=d[j][i]+d[k+(j%3)=3][i-1]; | ^ main.c:31:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 31 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^ main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input
s062572988
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0}; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } a=0; for(i=0;i<9;i++){ a=a+d[i][n]; prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:31:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 31 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^ main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input main.c:33:1: error: expected declaration or statement at end of input
s595182510
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0}; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } a=0; for(i=0;i<9;i++){ a+=d[i][n]; } prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:32:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 32 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:34:1: error: expected declaration or statement at end of input 34 | } | ^ main.c:34:1: error: expected declaration or statement at end of input main.c:34:1: error: expected declaration or statement at end of input
s327586354
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[810]={0},d[114][514]={0}; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } } } a=0; for(i=0;i<9;i++){ a+=d[i][n]; } prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:34:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 34 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:36:1: error: expected declaration or statement at end of input 36 | } | ^
s028688125
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[101]={0},d[9][101]={0}; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } } } a=0; for(i=0;i<9;i++){ a+=d[i][n]; } prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:23:19: error: lvalue required as left operand of assignment 23 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:34:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 34 | prinff("%d\n",a%10000); | ^~~~~~ | printf main.c:36:1: error: expected declaration or statement at end of input 36 | } | ^
s432081208
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[101]={0},d[9][101]={0}; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } } } a=0; for(i=0;i<9;i++){ a+=d[i][n]; } prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:24:19: error: lvalue required as left operand of assignment 24 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:35:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 35 | prinff("%d\n",a%10000); | ^~~~~~ | printf
s886654389
p00491
C
#include<stdio.h> int main(void) { int a,b,i,j,k,n,m,f[101]={0},d[9][101]={0}; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } } } for(i=a=0;i<9;i++){ a+=d[i][n]; } prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:24:19: error: lvalue required as left operand of assignment 24 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:34:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 34 | prinff("%d\n",a%10000); | ^~~~~~ | printf
s079847625
p00491
C
#include<stdio.h> int main(void) { int f[101]={0}; int d[9][101]={0}; int a,b,i,j,k,n,m; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } } } for(i=a=0;i<9;i++){ a+=d[i][n]; } prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:26:19: error: lvalue required as left operand of assignment 26 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:36:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 36 | prinff("%d\n",a%10000); | ^~~~~~ | printf
s988834278
p00491
C
#include<stdio.h> int main(void) { int f[101]={0}; int d[9][101]={0}; int a,b,i,j,k,n,m; scanf("%d %d",&n,&m); for(i=0;i<m;i++){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } } } for(i=a=0;i<9;i++){ a+=d[i][n]; prinff("%d\n",a%10000); } return 0; }
main.c: In function 'main': main.c:26:19: error: lvalue required as left operand of assignment 26 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:35:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 35 | prinff("%d\n",a%10000); | ^~~~~~ | printf
s457121071
p00491
C
#include<stdio.h> int main(void) { int f[101]={0}; int d[9][101]={0}; int a,b,i,j,k,n,m; scanf("%d %d",&n,&m); while(m--){ scanf("%d %d",&a,&b); f[a]=b; } for(i=0;i<9;i++){ d[i][2]=1; if(f[1] && f[1]-i%3-1){ d[i][2]=0; } if(f[2] && f[2]-i/3-1){ d[i][2]=0; } } for(i=3;i<n;i++){ for(j=0;j<9;j++){ if(f[i] && f[i]-1-j/3){ for(k=0;k<3;k++){ if(k==j%3 && j%3==j/3){ d[j][i]+=d[k+(j%3)=3][i-1]; d[j][i]%10000; } } } } } for(i=a=0;i<9;i++){ a+=d[i][n]; } prinff("%d\n",a%10000); return 0; }
main.c: In function 'main': main.c:26:19: error: lvalue required as left operand of assignment 26 | d[j][i]+=d[k+(j%3)=3][i-1]; | ^ main.c:36:1: error: implicit declaration of function 'prinff'; did you mean 'printf'? [-Wimplicit-function-declaration] 36 | prinff("%d\n",a%10000); | ^~~~~~ | printf
s356104705
p00491
C
include<stdio.h> #define MOD (10000) int t[104][6],r[104]; int main(void){ int n,k; int i; int a,b; int ans; scanf("%d%d",&n,&k); while(k--){ scanf("%d%d",&a,&b); r[a]=b; } if(r[1]!=0) t[1][(r[1]-1)*2]=1; else t[1][0]=t[1][2]=t[1][4]=1; for(i=2;i<=n;i++){ if(r[i]==0||r[i]==1){ t[i][0]=(t[i-1][2]+t[i-1][3]+t[i-1][4]+t[i-1][5])%MOD; t[i][1]=t[i-1][0]; } if(r[i]==0||r[i]==2){ t[i][2]=(t[i-1][0]+t[i-1][1]+t[i-1][4]+t[i-1][5])%MOD; t[i][3]=t[i-1][2]; } if(r[i]==0||r[i]==3){ t[i][4]=(t[i-1][0]+t[i-1][1]+t[i-1][2]+t[i-1][3])%MOD; t[i][5]=t[i-1][4]; } } ans=0; ans=(t[n][0]+t[n][1]+t[n][2]+t[n][3]+t[n][4]+t[n][5])%MOD; printf("%d\n",ans); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ main.c: In function 'main': main.c:10:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 10 | scanf("%d%d",&n,&k); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | include<stdio.h> main.c:10:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 10 | scanf("%d%d",&n,&k); | ^~~~~ main.c:10:5: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:13:9: error: 'r' undeclared (first use in this function) 13 | r[a]=b; | ^ main.c:13:9: note: each undeclared identifier is reported only once for each function it appears in main.c:16:17: error: 't' undeclared (first use in this function) 16 | if(r[1]!=0) t[1][(r[1]-1)*2]=1; | ^ main.c:37:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 37 | printf("%d\n",ans); | ^~~~~~ main.c:37:5: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:37:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:37:5: note: include '<stdio.h>' or provide a declaration of 'printf'
s386754839
p00491
C
#include<stdio.h> #define MOD 10000 int N ,K ; int plan[ 100 + 1 ][ 4 + 1 ][ 4 + 1 ] ; int _now[ 100 + 1 ] ; int Cnt( int day ,int prev ,int now ) { if( day == N ) { return 1 ; } int &next = _now[ day ] ; if( next > 0 ) { if( prev == now && now == next ) { return 0 ; } return Cnt( day + 1 ,now ,next ) ; } int &value = plan[ day ][ prev ][ now ] ; if( value > 0 ) { return value ; } int nex ,cnt = 0 ; for( nex = 1 ; nex <= 3 ; ++nex ) { if( prev != now || now != nex ) { cnt = (cnt + Cnt( day + 1 ,now ,nex )) % MOD ; } } return (value = cnt) ; } int main( void ) { scanf( "%d %d" ,&N ,&K ) ; ++N ; int i ,day ,menu ; for( i = 0 ; i < K ; ++i ) { scanf( "%d %d" ,&day ,&menu ) ; _now[ day ] = menu ; } printf( "%d\n" ,Cnt( 1 ,0 ,0 )) ; return 0 ; }
main.c: In function 'Cnt': main.c:16:13: error: expected identifier or '(' before '&' token 16 | int &next = _now[ day ] ; | ^ main.c:17:13: error: 'next' undeclared (first use in this function) 17 | if( next > 0 ) | ^~~~ main.c:17:13: note: each undeclared identifier is reported only once for each function it appears in main.c:27:13: error: expected identifier or '(' before '&' token 27 | int &value = plan[ day ][ prev ][ now ] ; | ^ main.c:28:13: error: 'value' undeclared (first use in this function) 28 | if( value > 0 ) | ^~~~~
s550048396
p00491
C
#include<stdio.h> #include<windows.h> #include<errno.h> #include<stdlib.h> #include<stddef.h> #define Iset int i,j,l #define man 10000 #define cn continue int pas[101], dt[101][4][4]; int main(){ int n, k; Iset; int ans = 0; scanf("%d%d", &n, &k); for (i = 0; i < k; i++) { int a, b; scanf("%d%d", &a, &b); pas[a] = b; } dt[0][0][0] = 1; for (i = 1; i <= n; i++) { if (pas[i] == 0) { for (j = 1; j <= 3; j++) { for (k = 0; k <= 3; k++) { for (l = 0; l <= 3; l++) { if (j == k && l == k) cn; dt[i][j][k] += dt[i - 1][k][l]; dt[i][j][k] %= man; }}}} else { for (k = 0; k <= 3; k++) { for (l = 0; l <= 3; l++) { if (pas[i] == k && l == k)cn; dt[i][pas[i]][k] += dt[i - 1][k][l]; dt[i][pas[i]][k] %= man; }}}} for (i = 1; i <= 3; i++) { for (j = 1; j <= 3; j++) { ans += dt[n][i][j]; ans %= man; }} printf("%d\n", ans); return 0; }
main.c:2:9: fatal error: windows.h: No such file or directory 2 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated.
s008178982
p00491
C
#include <stdio.h> #include <stdbool.h> #define H 6 #define W 100 struct AOJ{ int num; int lock; }; typedef struct AOJ AOJ_0568; void display00(AOJ_0568 data[][W], int height, int width){ int i, k; for(i=0; i<height; i++){ for(k=0; k<width; k++){ printf("%d ", data[i][k].num); } printf("\n"); } return; } int getResult(AOJ_0568 data[][W], int height, int width){ int i; int result = 0; for(i=0; i<height; i++){ result += data[i][width-1]%10000; } return result%10000; } int main(){ AOJ_0568 data[H][W]; int n, k; int a, b; int i, m; int result; scanf("%d %d", &n, &k); for(i=0; i<H; i++){ if(i%2==0){ data[i][0].num = 0; data[i][0].lock = 1; } else{ data[i][0].num = 1; data[i][0].lock = 1; } } for(i=0; i<H; i++){ for(m=1; m<n; m++){ data[i][m].num = 0; data[i][m].lock = 1; } } //display00(data, 6, n); //printf("\n\n\n"); for(i=0; i<k; i++){ scanf("%d %d", &a, &b); if(b==1){ data[2][a-1].num = 0; data[2][a-1].lock = 0; data[3][a-1].num = 0; data[3][a-1].lock = 0; data[4][a-1].num = 0; data[4][a-1].lock = 0; data[5][a-1].num = 0; data[5][a-1].lock = 0; } else if(b==2){ data[0][a-1].num = 0; data[0][a-1].lock = 0; data[1][a-1].num = 0; data[1][a-1].lock = 0; data[4][a-1].num = 0; data[4][a-1].lock = 0; data[5][a-1].num = 0; data[5][a-1].lock = 0; } else if(b==3){ data[0][a-1].num = 0; data[0][a-1].lock = 0; data[1][a-1].num = 0; data[1][a-1].lock = 0; data[2][a-1].num = 0; data[2][a-1].lock = 0; data[3][a-1].num = 0; data[3][a-1].lock = 0; } } for(m=1; m<n; m++){ for(i=0; i<H; i++){ switch(i){ case 0: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; } break; case 1: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; data[i][m].num += data[i+2][m-1].num; data[i][m].num += data[i+3][m-1].num; data[i][m].num += data[i+4][m-1].num; } break; case 2: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; } break; case 3: if(data[i][m].lock){ data[i][m].num += data[i-3][m-1].num; data[i][m].num += data[i-2][m-1].num; data[i][m].num += data[i+1][m-1].num; data[i][m].num += data[i+2][m-1].num; } break; case 4: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; } break; case 5: if(data[i][m].lock){ data[i][m].num += data[i-5][m-1].num; data[i][m].num += data[i-4][m-1].num; data[i][m].num += data[i-3][m-1].num; data[i][m].num += data[i-2][m-1].num; } break; } } } //display00(data, 6, n); result = getResult(data, H, n); printf("%d\n", result); return 0; }
main.c: In function 'getResult': main.c:28:43: error: invalid operands to binary % (have 'AOJ_0568' {aka 'struct AOJ'} and 'int') 28 | result += data[i][width-1]%10000; | ~~~~~~~~~~~~~~~~^ | | | AOJ_0568 {aka struct AOJ}
s742881142
p00491
C
#include <stdio.h> #define H 6 #define W 100 struct AOJ{ int num; int lock; }; typedef struct AOJ AOJ_0568; void display00(AOJ_0568 data[][W], int height, int width){ int i, k; for(i=0; i<height; i++){ for(k=0; k<width; k++){ printf("%d ", data[i][k].num); } printf("\n"); } return; } int getResult(AOJ_0568 data[][W], int height, int width){ int i; int result = 0; for(i=0; i<height; i++){ result += data[i][width-1]%10000; } return result%10000; } int main(){ AOJ_0568 data[H][W]; int n, k; int a, b; int i, m; int result; scanf("%d %d", &n, &k); for(i=0; i<H; i++){ if(i%2==0){ data[i][0].num = 0; data[i][0].lock = 1; } else{ data[i][0].num = 1; data[i][0].lock = 1; } } for(i=0; i<H; i++){ for(m=1; m<n; m++){ data[i][m].num = 0; data[i][m].lock = 1; } } //display00(data, 6, n); //printf("\n\n\n"); for(i=0; i<k; i++){ scanf("%d %d", &a, &b); if(b==1){ data[2][a-1].num = 0; data[2][a-1].lock = 0; data[3][a-1].num = 0; data[3][a-1].lock = 0; data[4][a-1].num = 0; data[4][a-1].lock = 0; data[5][a-1].num = 0; data[5][a-1].lock = 0; } else if(b==2){ data[0][a-1].num = 0; data[0][a-1].lock = 0; data[1][a-1].num = 0; data[1][a-1].lock = 0; data[4][a-1].num = 0; data[4][a-1].lock = 0; data[5][a-1].num = 0; data[5][a-1].lock = 0; } else if(b==3){ data[0][a-1].num = 0; data[0][a-1].lock = 0; data[1][a-1].num = 0; data[1][a-1].lock = 0; data[2][a-1].num = 0; data[2][a-1].lock = 0; data[3][a-1].num = 0; data[3][a-1].lock = 0; } } for(m=1; m<n; m++){ for(i=0; i<H; i++){ switch(i){ case 0: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; } break; case 1: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; data[i][m].num += data[i+2][m-1].num; data[i][m].num += data[i+3][m-1].num; data[i][m].num += data[i+4][m-1].num; } break; case 2: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; } break; case 3: if(data[i][m].lock){ data[i][m].num += data[i-3][m-1].num; data[i][m].num += data[i-2][m-1].num; data[i][m].num += data[i+1][m-1].num; data[i][m].num += data[i+2][m-1].num; } break; case 4: if(data[i][m].lock){ data[i][m].num += data[i+1][m-1].num; } break; case 5: if(data[i][m].lock){ data[i][m].num += data[i-5][m-1].num; data[i][m].num += data[i-4][m-1].num; data[i][m].num += data[i-3][m-1].num; data[i][m].num += data[i-2][m-1].num; } break; } } } //display00(data, 6, n); result = getResult(data, H, n); printf("%d\n", result); return 0; }
main.c: In function 'getResult': main.c:27:43: error: invalid operands to binary % (have 'AOJ_0568' {aka 'struct AOJ'} and 'int') 27 | result += data[i][width-1]%10000; | ~~~~~~~~~~~~~~~~^ | | | AOJ_0568 {aka struct AOJ}
s331787313
p00491
C++
#inlcude<cstdio> using namespace std; int d[100], n, k, dp[100][6]; // 0:aa, 1:bb, 2:cc, 3:a, 4:b, 5:c int main() { int a, b; scanf("%d%d", &a, &b); for (int i = 0; i < n; i++) d[i] = 0; for (int i = 0; i < k; i++) scanf("%d%d", &a, &b), d[a-1] = b; dp[0][0] = dp[0][1] = dp[0][2] = dp[0][3] = dp[0][4] = dp[0][5] = 0; if (d[0] == 0) dp[0][3] = dp[0][4] = dp[0][5] = 1; if (d[0] == 1) dp[0][3] = 1; if (d[0] == 2) dp[0][4] = 1; if (d[0] == 3) dp[0][5] = 1; for (int i = 1; i < n; i++) { dp[i][0] = dp[i-1][3]; dp[i][1] = dp[i-1][4]; dp[i][2] = dp[i-1][5]; dp[i][3] = dp[i-1][1] + dp[i-1][2]; dp[i][4] = dp[i-1][0] + dp[i-1][2]; dp[i][5] = dp[i-1][0] + dp[i-1][1]; for (int j = 0; j < 6; j++) dp[i][j] = dp[i][j] % 10000; if (d[i] == 0) continue; if (d[i] == 1) dp[i][1] = dp[i][2] = dp[i][4] = dp[i][5] = 0; if (d[i] == 2) dp[i][0] = dp[i][2] = dp[i][3] = dp[i][5] = 0; if (d[i] == 3) dp[i][0] = dp[i][1] = dp[i][3] = dp[i][4] = 0; } int ans = 0; for (int j = 0; j < 6; j++) ans += dp[n-1][j]; printf("%d\n", ans % 10000); }
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include? 1 | #inlcude<cstdio> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:9:3: error: 'scanf' was not declared in this scope 9 | scanf("%d%d", &a, &b); | ^~~~~ a.cc:32:3: error: 'printf' was not declared in this scope 32 | printf("%d\n", ans % 10000); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #inlcude<cstdio>
s130930352
p00491
C++
#include <iostream> using namespace std; enum Sauce{NOT_DETERMINED=0, Tomato=1, Cream=2, Basil=3}; enum Seq{SAME, DIFF}; const int divisor = 10000; class Pasta{ public: Pasta(int _N); ~Pasta(); static Sauce* sauceary; int schedule(int i, Sauce yesterday, Seq seq); private: int N; int** memo; }; Pasta::Pasta(int _N){ N = _N; sauceary = new Sauce[N+1]; memo = new int*[N+1]; for (int i = 0; i <= N; i++) sauceary[i] = NOT_DETERMINED; for (int i = 0; i <= N; i++){ memo[i] = new int[4]; for (int j = 0; j < 4; j++) memo[i][j] = -1; } } Pasta::~Pasta(){ delete[] sauceary; delete[] memo; } int Pasta::schedule(int i, Sauce yesterday, Seq seq){ if (i == N+1) return 1; if (seq == SAME && yesterday == sauceary[i]) return 0; if (sauceary[i] == NOT_DETERMINED){ switch (yesterday){ case Tomato: if (seq == SAME) return (schedule(i+1, Cream, DIFF) + schedule(i+1, Basil, DIFF)) % divisor; else if (seq == DIFF) return (schedule(i+1, Tomato, SAME) + schedule(i+1, Cream, DIFF) + schedule(i+1, Basil, DIFF)) % divisor; case Cream: if (seq == SAME) return (schedule(i+1, Tomato, DIFF) + schedule(i+1, Basil, DIFF)) % divisor; else if (seq == DIFF) return (schedule(i+1, Tomato, DIFF) + schedule(i+1, Cream, SAME) + schedule(i+1, Basil, DIFF)) % divisor; case Basil: if (seq == SAME) return (schedule(i+1, Tomato, DIFF) + schedule(i+1, Cream, DIFF)) % divisor; else if (seq == DIFF) return (schedule(i+1, Tomato, DIFF) + schedule(i+1, Cream, DIFF) + schedule(i+1, Basil, SAME)) % divisor; } } else { if (yesterday == sauceary[i]) return schedule(i+1, sauceary[i], SAME) % divisor; else return schedule(i+1, sauceary[i], DIFF) % divisor; } } int main(){ int N, K; cin >> N >> K; Pasta* pasta = new Pasta(N); for (int i = 0; i < K; i++){ int A, B; cin >> A >> B; pasta->sauceary[A] = (Sauce)B; } int ans; if (pasta->sauceary[1] == NOT_DETERMINED){ ans = pasta->schedule(2, Tomato, DIFF) + pasta->schedule(2, Cream, DIFF) + pasta->schedule(2, Basil, DIFF); } else { ans = pasta->schedule(2, pasta->sauceary[1], DIFF); } cout << ans % divisor << endl; delete pasta; return 0; }
a.cc: In member function 'int Pasta::schedule(int, Sauce, Seq)': a.cc:61:1: warning: control reaches end of non-void function [-Wreturn-type] 61 | } | ^ /usr/bin/ld: /tmp/ccbWW54A.o: warning: relocation against `_ZN5Pasta8saucearyE' in read-only section `.text' /usr/bin/ld: /tmp/ccbWW54A.o: in function `Pasta::Pasta(int)': a.cc:(.text+0x42): undefined reference to `Pasta::sauceary' /usr/bin/ld: a.cc:(.text+0x8f): undefined reference to `Pasta::sauceary' /usr/bin/ld: /tmp/ccbWW54A.o: in function `Pasta::~Pasta()': a.cc:(.text+0x145): undefined reference to `Pasta::sauceary' /usr/bin/ld: a.cc:(.text+0x151): undefined reference to `Pasta::sauceary' /usr/bin/ld: /tmp/ccbWW54A.o: in function `Pasta::schedule(int, Sauce, Seq)': a.cc:(.text+0x1b5): undefined reference to `Pasta::sauceary' /usr/bin/ld: /tmp/ccbWW54A.o:a.cc:(.text+0x1da): more undefined references to `Pasta::sauceary' follow /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status
s217026706
p00491
C++
#include<iostream> #include<cstdio> using namespace std; int main(){ int N,K,A,B[101]; int dp[101][7]={},ans=0; memset(B,-1,sizeof(B)); cin>>N>>K; for(int i=0;i<K;i++){ cin>>A; cin>>B[A]; } dp[0][0]=1; for(int i=0;i<N;i++){ for(int j=0;j<=6;j++){ //printf("%d ",dp[i][j]); if(B[i]!=-1 && (j!=B[i] && j!=B[i]+3)) continue; else{ for(int k=1;k<=3;k++){ if(j-3==k) continue; else if(j==k) dp[i+1][j+3] += dp[i][j]; else dp[i+1][k] += dp[i][j]; } } }//puts(""); } for(int i=0;i<=6;i++){ //printf("%d ",dp[N][i]); ans += dp[N][i]; }//puts(""); printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'memset' was not declared in this scope 8 | memset(B,-1,sizeof(B)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<cstdio> +++ |+#include <cstring> 3 | using namespace std;
s166573027
p00491
C++
cin>>n>>k; for(int i=0;i<k;i++){ int a,b; cin>>a>>b; if(b==1)dp[a][2]=INF,dp[a][3]=INF; if(b==2)dp[a][1]=INF,dp[a][3]=INF; if(b==3)dp[a][1]=INF,dp[a][2]=INF; } for(int i=1;i<=3;i++)if(dp[1][i]!=INF)dp[1][i]=1; for(int i=1;i<=n;i++){ for(int j=1;j<=3;j++){ if(dp[i+1][j]!=INF){ for(int k=1;k<=3;k++){ if(dp[i][k]!=INF){ if(j==k&&i+1>=3&&dp[i-1][k]!=INF){ dp[i+1][j]=(dp[i+1][k]+dp[i][k]-dp[i-1][k])%10000; } else dp[i+1][j]+=(dp[i][k])%10000; } } } } } // REP(i,n+1){ //for(int j=1;j<=3;j++)cout<<dp[i][j]<<" "; // cout<<endl; // } int ans=0; for(int i=1;i<=3;i++)ans+=dp[n][i]; cout<<ans%10000<<endl; return 0; }
a.cc:1:9: error: 'cin' does not name a type 1 | cin>>n>>k; | ^~~ a.cc:2:9: error: expected unqualified-id before 'for' 2 | for(int i=0;i<k;i++){ | ^~~ a.cc:2:21: error: 'i' does not name a type 2 | for(int i=0;i<k;i++){ | ^ a.cc:2:25: error: 'i' does not name a type 2 | for(int i=0;i<k;i++){ | ^ a.cc:9:9: error: expected unqualified-id before 'for' 9 | for(int i=1;i<=3;i++)if(dp[1][i]!=INF)dp[1][i]=1; | ^~~ a.cc:9:21: error: 'i' does not name a type 9 | for(int i=1;i<=3;i++)if(dp[1][i]!=INF)dp[1][i]=1; | ^ a.cc:9:26: error: 'i' does not name a type 9 | for(int i=1;i<=3;i++)if(dp[1][i]!=INF)dp[1][i]=1; | ^ a.cc:11:9: error: expected unqualified-id before 'for' 11 | for(int i=1;i<=n;i++){ | ^~~ a.cc:11:21: error: 'i' does not name a type 11 | for(int i=1;i<=n;i++){ | ^ a.cc:11:26: error: 'i' does not name a type 11 | for(int i=1;i<=n;i++){ | ^ a.cc:31:9: error: expected unqualified-id before 'for' 31 | for(int i=1;i<=3;i++)ans+=dp[n][i]; | ^~~ a.cc:31:21: error: 'i' does not name a type 31 | for(int i=1;i<=3;i++)ans+=dp[n][i]; | ^ a.cc:31:26: error: 'i' does not name a type 31 | for(int i=1;i<=3;i++)ans+=dp[n][i]; | ^ a.cc:32:9: error: 'cout' does not name a type 32 | cout<<ans%10000<<endl; | ^~~~ a.cc:33:9: error: expected unqualified-id before 'return' 33 | return 0; | ^~~~~~ a.cc:34:1: error: expected declaration before '}' token 34 | } | ^
s773306595
p00491
C++
#include <stdio.h> #include <string.h> int main(){ int N,K;//N日分のシミュレーション scanf("%d %d",&N,&K); long long int dp[N][3]; long long int delete[3]; int i,j,k; memset(dp,0,sizeof(dp));//初期化 memset(delete,0,sizeof(delete)); int a,b; for(i=0;i<K;i++){ scanf("%d %d",&a,&b); dp[a-1][b-1]=1; } if(dp[0][0]==0&&dp[0][1]==0&&dp[0][2]==0){//予約がなければ全てあり得る dp[0][0]++; dp[0][1]++; dp[0][2]++; } int flag; long long int temp=0; for(i=1;i<N;i++){ flag=0; temp=dp[i-1][0]+dp[i-1][1]+dp[i-1][2]; for(j=0;j<3;j++){ if(dp[i][j]==1){ dp[i][j]=temp-delete[j]; for(k=0;k<3;k++){ if(k==j){ delete[j]=dp[i-1][j]-delete[j];//2日連チャンで食べている通り } else{ delete[k]=0; } } flag=1; break; } } if(flag==0){ for(j=0;j<3;j++){ dp[i][j]=temp-delete[j]; delete[j]=dp[i-1][j]-delete[j]; } } if(delete[0]>10000&&delete[1]>10000&&delete[2]>10000){ delete[0]%=10000; delete[1]%=10000; delete[2]%=10000; dp[i][0]=(dp[i][0]%10000)+10000; dp[i][1]=(dp[i][1]%10000)+10000; dp[i][2]=(dp[i][2]%10000)+10000; } } printf("%lld\n",(dp[N-1][0]+dp[N-1][1]+dp[N-1][2])%10000); return 0; }
a.cc: In function 'int main()': a.cc:7:23: error: expected unqualified-id before 'delete' 7 | long long int delete[3]; | ^~~~~~ a.cc:10:22: error: expected primary-expression before ',' token 10 | memset(delete,0,sizeof(delete)); | ^ a.cc:10:38: error: expected primary-expression before ')' token 10 | memset(delete,0,sizeof(delete)); | ^ a.cc:28:54: error: expected ']' before 'j' 28 | dp[i][j]=temp-delete[j]; | ^ | ] a.cc:28:54: error: type 'int' argument given to 'delete', expected pointer a.cc:31:56: error: expected ']' before 'j' 31 | delete[j]=dp[i-1][j]-delete[j];//2日連チャンで食べている通り | ^ | ] a.cc:31:56: error: type 'int' argument given to 'delete', expected pointer a.cc:34:56: error: expected ']' before 'k' 34 | delete[k]=0; | ^ | ] a.cc:34:56: error: type 'int' argument given to 'delete', expected pointer a.cc:43:54: error: expected ']' before 'j' 43 | dp[i][j]=temp-delete[j]; | ^ | ] a.cc:43:54: error: type 'int' argument given to 'delete', expected pointer a.cc:44:40: error: expected ']' before 'j' 44 | delete[j]=dp[i-1][j]-delete[j]; | ^ | ] a.cc:44:40: error: type 'int' argument given to 'delete', expected pointer a.cc:47:27: error: expected ']' before numeric constant 47 | if(delete[0]>10000&&delete[1]>10000&&delete[2]>10000){ | ^ | ] a.cc:47:27: error: type 'int' argument given to 'delete', expected pointer a.cc:47:28: error: expected ')' before ']' token 47 | if(delete[0]>10000&&delete[1]>10000&&delete[2]>10000){ | ~ ^ | ) a.cc:47:28: error: expected primary-expression before ']' token
s328809409
p00491
C++
#include<iostream> using namespace std; int n,m; const int mod=10000; int yotei[101]; int dp[101][3][3]={}; int pasta(int day,int tdby,int y){//日日 おととい 昨日 if(dp[day][tdby][y]!=0)return dp[day][tdby][y]; if(day==n+1)return 1; if(yotei[day]!=-1){ if(tdby==y&&y==yotei[day]){ return 0; }else { return dp[day][tdby][y]=pasta(day+1,y,yotei[day])%mod; } }else { int ans=0; for(int k=1;k<=3;k++){ if(tdby!=k||y!=k){ ans+=pasta(day+1,y,k)%mod; } } return dp[day][tdby][y]=ans%mod; } } //dayは1から 便宜上 int main(){ memset(yotei,-1,sizeof(yotei)); cin>>n>>m; for(int i=1;i<=m;i++){ int a; cin>>a; cin>>yotei[a]; } cout<<pasta(1,0,0)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:31:9: error: 'memset' was not declared in this scope 31 | memset(yotei,-1,sizeof(yotei)); | ^~~~~~ a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 |
s700896558
p00491
C++
import Control.Monad import Control.Applicative import Data.List main = do [n, k] <- map (read :: String -> Int) . words <$> getLine l <- map (map (read :: String -> Int) . words) <$> replicateM k getLine print $ solve n l func :: Int -> [[Int]] -> [(Int, Int)] func n [] = [(x, -1) | x <- [1..n]] func n ([a, b]:c) = map (\(x, y) -> if x == a then (x, b) else (x, y)) $ func n c foldw :: [Int] -> Int foldw [] = 0 foldw a = foldl1 (+) a solvew :: Int -> Int -> [Int] -> Int solvew _ _ [] = 1 solvew a b (c:d) | a == b = (foldw [solvew x a d | x <- [1..3], x /= a, x == c || c == -1]) `mod` 10000 | otherwise = (foldw [solvew x a d | x <- [1..3], x == c || c == -1]) `mod` 10000 solve :: Int -> [[Int]] -> Int solve n l = solvew (-2) (-2) $ map (\(x, y) -> y) $ func n l
a.cc:11:30: error: too many decimal points in number 11 | func n [] = [(x, -1) | x <- [1..n]] | ^~~~ a.cc:12:26: error: stray '\' in program 12 | func n ([a, b]:c) = map (\(x, y) -> if x == a then (x, b) else (x, y)) $ func n c | ^ a.cc:21:49: error: too many decimal points in number 21 | | a == b = (foldw [solvew x a d | x <- [1..3], x /= a, x == c || c == -1]) `mod` 10000 | ^~~~ a.cc:21:84: error: stray '`' in program 21 | | a == b = (foldw [solvew x a d | x <- [1..3], x /= a, x == c || c == -1]) `mod` 10000 | ^ a.cc:21:88: error: stray '`' in program 21 | | a == b = (foldw [solvew x a d | x <- [1..3], x /= a, x == c || c == -1]) `mod` 10000 | ^ a.cc:22:52: error: too many decimal points in number 22 | | otherwise = (foldw [solvew x a d | x <- [1..3], x == c || c == -1]) `mod` 10000 | ^~~~ a.cc:22:79: error: stray '`' in program 22 | | otherwise = (foldw [solvew x a d | x <- [1..3], x == c || c == -1]) `mod` 10000 | ^ a.cc:22:83: error: stray '`' in program 22 | | otherwise = (foldw [solvew x a d | x <- [1..3], x == c || c == -1]) `mod` 10000 | ^ a.cc:25:37: error: stray '\' in program 25 | solve n l = solvew (-2) (-2) $ map (\(x, y) -> y) $ func n l | ^ a.cc:1:1: error: 'import' does not name a type 1 | import Control.Monad | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s812830670
p00491
C++
#include<iostream> #include<map> using namespace std; typedef long long int ll; ll dfs(int day,int r1,int r2); ll dp[101][4][4],n,k; map<int,int> plan; int main(){ cin >> n >> k; for(int i=0;i<k;i++){ int a,b; cin >> a >> b; a--; plan[a] = b; } memset(dp,-1,sizeof(dp)); cout << dfs(0,0,0)%10000 << endl; } ll dfs(int day,int r1,int r2){ if(day==n) return 1; if(dp[day][r1][r2] != -1) return dp[day][r1][r2]; if(plan[day] != 0){ if(r1 == r2 && r1 == plan[day]) return 0; else return dfs(day+1,plan[day],r1); } ll ret = 0; for(int i=1;i<=3;i++){ if(r1 == r2 && r1 == i) continue; ret += dfs(day+1,i,r1); } return dp[day][r1][r2] = ret; }
a.cc: In function 'int main()': a.cc:14:9: error: 'memset' was not declared in this scope 14 | memset(dp,-1,sizeof(dp)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<map> +++ |+#include <cstring> 3 | using namespace std;
s198242100
p00491
C++
#include <iostream> using namespace std; int main() { int n, k, l, m; cin >> n >> k; int krsw[101][3] = {}; int a[100] = {} ; for(int i = 0; i < k; i++) { cin >> l >> m; a[l] = m; } if(a[1]) krsw[1][a[1]] = 1; else { krsw[1][1] = 1; krsw[1][2] = 1; krsw[1][3] = 1; } for(int hi = 2; hi <= n; hi++) { if(a[hi]) { krsw[hi][a[hi]] = krsw[hi - 1][1] + krsw[hi - 1][2] + krsw[hi - 1][3]; if(krsw[hi - 1][a[hi]] > 0 && krsw[hi - 2][a[hi]] > 0) { krsw[hi][a[hi]] -= krsw[hi - 2][a[hi]]; krsw[hi - 1][a[hi]] -= krsw[hi - 2][a[hi]]; if(a[hi - 2]) { krsw[hi][a[hi - 2]] = 0; krsw[hi - 1][a[hi - 2]] = 0; } if(krsw[hi][a[hi]]>10000)krsw[hi][a[hi]] %= 10000; } else for(int i = 1; i <= 3; i++) { krsw[hi][i] = krsw[hi - 1][1] + krsw[hi - 1][2] + krsw[hi - 1][3]; if(krsw[hi - 1][i] > 0 && krsw[hi - 2][i] > 0) { krsw[hi][i] -= krsw[hi - 2][i]; krsw[hi - 1][i] -= krsw[hi - 2][i]; } if(a[hi - 2]) { krsw[hi][a[hi - 2]] = 0; krsw[hi - 1][a[hi - 2]] = 0; } } if(krsw[hi][i]>10000)krsw[hi][i] %= 10000; } } cout << (krsw[n][1] + krsw[n][2] + krsw[n][3]) % 10000 << endl; return 0; }
a.cc: In function 'int main()': a.cc:39:45: error: 'i' was not declared in this scope; did you mean 'hi'? 39 | if(krsw[hi][i]>10000)krsw[hi][i] %= 10000; | ^ | hi
s469393926
p00491
C++
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 #include<bits/stdc++.h> #define LL long long #define FOR(i,a,b) for(int i=a;i<=b;++i) using namespace std; static const LL MAX_N = 1e+5; static const LL INF = 1 << 25; struct clothes{ LL A[MAX_N],B[MAX_N],C[MAX_N]; }; int N,D; LL res=-INF; LL Day[MAX_N]; clothes T; void cal(LL day,LL p,LL pp,LL sum){ //cout<<sum+abs(pp-p)<<" "<<day<<" "<<p<<" "<<pp<<endl; if(res<sum+abs(pp-p))res=sum+abs(pp-p); if(day==N+1)return 0; if(day==0){ FOR(i,1,D) if(Day[1]>=T.A[i]&&Day[1]<=T.B[i])cal(day+1,T.C[i],p,sum); } FOR(i,1,D){ if(Day[day]>=T.A[i]&&Day[day]<=T.B[i]){ if(day>2)cal(day+1,T.C[i],p,sum+abs(pp-p)); else cal(day+1,T.C[i],p,sum); } } return res; } int main(){ cin>>N>>D; FOR(i,1,N)cin>>Day[i]; FOR(i,1,D) cin>>T.A[i]>>T.B[i]>>T.C[i]; cal(0,0,0,0); cout<<res<<endl; }
a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 3 | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:43: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s075853636
p00491
C++
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 #include<bits/stdc++.h> #define LL long long #define FOR(i,a,b) for(int i=a;i<=b;++i) using namespace std; static const LL MAX_N = 1e+5; static const LL INF = 1 << 25; struct clothes{ LL A[MAX_N],B[MAX_N],C[MAX_N]; }; int N,D; LL res=-INF; LL Day[MAX_N]; clothes T; int cal(LL day,LL p,LL pp,LL sum){ //cout<<sum+abs(pp-p)<<" "<<day<<" "<<p<<" "<<pp<<endl; if(res<sum+abs(pp-p))res=sum+abs(pp-p); if(day==N+1)return 0; if(day==0){ FOR(i,1,D) if(Day[1]>=T.A[i]&&Day[1]<=T.B[i])cal(day+1,T.C[i],p,sum); } FOR(i,1,D){ if(Day[day]>=T.A[i]&&Day[day]<=T.B[i]){ if(day>2)cal(day+1,T.C[i],p,sum+abs(pp-p)); else cal(day+1,T.C[i],p,sum); } } return res; } int main(){ cin>>N>>D; FOR(i,1,N)cin>>Day[i]; FOR(i,1,D) cin>>T.A[i]>>T.B[i]>>T.C[i]; cal(0,0,0,0); cout<<res<<endl; }
a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 3 | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:43: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s040558307
p00491
C++
#include <bits/stdc++.h> using namespace std ; #define pb(n) push_back(n) #define fi first #define se second #define X real() #define Y imag() #define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h) #define all(r) (r).begin(),(r).end() #define gsort(st,en) sort((st),(en),greater<int>()) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout<<#x<<": "<<x<<endl #define fcout(n) cout<<fixed<<setprecision((n)) #define scout(n) cout<<setw(n) #define vary(Type,Arg,W,H,Init) (vector<vector<(Type)>> Arg ((W),(vector<(Type)>(H,Init)))) #define rep(i,n) for(int i = 0; i < (int)(n);++i) #define REP(i,a,b) for(int i = (a);i < (int)(b);++i) #define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it) #define repa(n,array) for(auto &n :(array)) typedef long long ll ; typedef deque<int> di ; typedef deque<ll> dl ; typedef map<string,int> dict; typedef complex<double> comd; typedef pair<int,int> pii; constexpr int imax = ((1<<30)-1)*2+1 ; constexpr int inf = 100000000; constexpr double PI = acos(-1.0) ; double eps = 1e-10 ; const int dy[] = {-1,0,1,0}; const int dx[] = {0,-1,0,1}; double CalcDist(comd p1, comd p2){ return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0)); } template <typename T> void out(deque < T > d) { for(size_t i = 0; i < d.size(); i++) { debug(d[i]); } } template<typename T> T ston(string& str, T n){ istringstream sin(str) ; T num ; sin >> num ; return num ; } int N,K,a,b; int p[110]; // int dp[45][100]; // vary(int,dp,45,100,0); int ans = 0; int main(){ cin.tie(0); ios::sync_with_stdio(false); cin >> N >> K; rep(i,K){ cin >> a >> b; p[a] = b ; } vector<vector<vector<int>>> dp(N+1,vector<vector<int>>(4,vector<int>(4))); // 1:11 2:12 3:13 4:21 5:22 6:23 7:31 8:32 9:33 rep(i,3){ if(p[1] == i){ dp[1][c][0] = 1; } } REP(i,2,N+1){ REP(c,1,4){ if(p[i] == c || p[i] == 0){//c????????\???????£?????????? REP(pc1,1,4){//?????\ REP(pc2,1,4){//????????\ if(!(c == pc1 && pc1 == pc2)){//?????\??£?¶???§?????? dp[i][c][pc1] += dp[i-1][pc1][pc2]; dp[i][c][pc1] %= 10000; } } } } } } ll ans = 0; REP(i,1,4){ REP(j,1,4){ ans += dp[N][i][j]; ans %= 10000; } } cout << ans % 10000 << endl; return 0; }
a.cc: In function 'int main()': a.cc:75:13: error: 'c' was not declared in this scope 75 | dp[1][c][0] = 1; | ^ a.cc:84:45: error: 'pc2' was not declared in this scope; did you mean 'pc1'? 84 | dp[i][c][pc1] += dp[i-1][pc1][pc2]; | ^~~ | pc1 a.cc: At global scope: a.cc:91:3: error: expected declaration before '}' token 91 | } | ^ a.cc:92:6: error: conflicting declaration 'll ans' 92 | ll ans = 0; | ^~~ a.cc:62:5: note: previous declaration as 'int ans' 62 | int ans = 0; | ^~~ a.cc:20:20: error: expected unqualified-id before 'for' 20 | #define REP(i,a,b) for(int i = (a);i < (int)(b);++i) | ^~~ a.cc:93:3: note: in expansion of macro 'REP' 93 | REP(i,1,4){ | ^~~ a.cc:93:7: error: 'i' does not name a type; did you mean 'di'? 93 | REP(i,1,4){ | ^ a.cc:20:36: note: in definition of macro 'REP' 20 | #define REP(i,a,b) for(int i = (a);i < (int)(b);++i) | ^ a.cc:20:49: error: expected unqualified-id before '++' token 20 | #define REP(i,a,b) for(int i = (a);i < (int)(b);++i) | ^~ a.cc:93:3: note: in expansion of macro 'REP' 93 | REP(i,1,4){ | ^~~ a.cc:99:3: error: 'cout' does not name a type; did you mean 'fcout'? 99 | cout << ans % 10000 << endl; | ^~~~ | fcout a.cc:100:3: error: expected unqualified-id before 'return' 100 | return 0; | ^~~~~~ a.cc:101:1: error: expected declaration before '}' token 101 | } | ^
s898633128
p00491
C++
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; using ld = long double; template<class T> using Table = vector<vector<T>>; int main() { int N, K; cin >> N >> K; vector<int>dis(N); for (int i = 0; i < K; ++i) { int a, b; cin >> a >> b; a--; dis[a] = b; } int dp[200][4][4]; memset(dp, 0, sizeof(dp)); dp[0][0][0] = 1; for (int day = 0; day <N; ++day) { for (int prepre = 0; prepre <= 3; ++prepre) { for (int pre = 0; pre <= 3; ++pre) { for (int now = 1; now <= 3; now++) { if (dis[day] && dis[day] != now)continue; else { if (prepre == pre&&pre == now)continue; dp[day + 1][pre][now] += dp[day][prepre][pre]; dp[day + 1][pre][now] %= 10000; } long long int ans = 0; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { ans += dp[N][i][j]; } } cout << ans%10000 << endl; return 0; }
a.cc: In function 'int main()': a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:24:60: note: to match this '{' 24 | for (int pre = 0; pre <= 3; ++pre) { | ^ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:23:61: note: to match this '{' 23 | for (int prepre = 0; prepre <= 3; ++prepre) { | ^ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:22:42: note: to match this '{' 22 | for (int day = 0; day <N; ++day) { | ^ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:11:12: note: to match this '{' 11 | int main() { | ^
s189862671
p00491
C++
#include <iostream> #define rep(i,n) for(int i = 0; i < n; i++) using namespace std; テつ? int dp[3][110][2], num[110]; int n,k; テつ? int main(){ テつ?つ?つ?つ?ep(i,110) num[i] = -1; テつ?つ?つ?つ?in >> n >> k; テつ?つ?つ?つ?ep(i,k){ テつ?つ?つ?つ?つ?つ?つ?つ?nt a,b; テつ?つ?つ?つ?つ?つ?つ?つ?in >> a >> b; テつ?つ?つ?つ?つ?つ?つ?つ?--; b--; テつ?つ?つ?つ?つ?つ?つ?つ?um[a] = b; テつ?つ?つ?つ? テつ?つ?つ?つ?f(num[0] == -1) rep(i,3) dp[i][0][0] = 1; テつ?つ?つ?つ?lse dp[num[0]][0][0] = 1; テつ?つ?つ?つ?or(int i = 1; i < n; i++){ テつ?つ?つ?つ?つ?つ?つ?つ?ep(j,3){ テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?f(num[i] != -1 && num[i] != j) continue; テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?p[j][i][1] += dp[j][i-1][0]; テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?p[j][i][1] %= 10000; テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ep(u,3){ テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?f(j == u) continue; テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?p[j][i][0] += dp[u][i-1][0]+dp[u][i-1][1]; テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?p[j][i][0] %= 10000; テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ? テつ?つ?つ?つ?つ?つ?つ?つ? テつ?つ?つ?つ? テつ?つ?つ?つ?つ?つ?つ?つ?* テつ?つ?つ?つ?ep(i,n){ テつ?つ?つ?つ?つ?つ?つ?つ?ep(j,3){ テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ep(u,2){ テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?out << dp[j][i][u] << " "; テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ? テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?out << endl; テつ?つ?つ?つ?つ?つ?つ?つ? テつ?つ?つ?つ?つ?つ?つ?つ?out << endl; テつ?つ?つ?つ? テつ?つ?つ?つ?/ テつ?つ?つ?つ?nt ans = 0; テつ?つ?つ?つ?ep(i,3) rep(j,2) ans += dp[i][n-1][j]; テつ?つ?つ?つ?out << ans%10000 << endl; }
a.cc:4:1: error: '\U000030c6\U00003064' does not name a type 4 | テつ? | ^~~~ a.cc:7:1: error: '\U000030c6\U00003064' does not name a type 7 | テつ? | ^~~~
s951866333
p00491
C++
#include<cstdio> #include<functional> #include<algorithm> #include<iostream> #include<cstring> #include<string> #include<cstdlib> #include<cctype> #include<queue> #define MM #define rep(i,a) for(int i=0;i<a;i++) #define rep2(i,a) for(int i=1;i<=a;i++) #define rep3(i,a) for(int i=1;i<a;i++) #define rep4(i,a) for(int i=0;i<=a;i++) using namespace std; int dp[101][4][4]; long long int sum; int main(void) { int x,y; int day,al,sosu[101]={MM}; cin>>day>>al; rep(i,al) {cin>>x>>y;sosu[x]=y;} dp[MM][MM][MM]=1; rep2(i,day)rep(j,4)rep(k,4)rep3(kk,4) { if((j!=k||k!=kk)&&(sosu[i]==MM||sosu[i]==kk)) { dp[i][k][kk]+=dp[i-1][j][k]; dp[i][k][kk]%=10000; } } sum=0; rep2(i,3)rep4(j,3) sum+=dp[day][i][j]; cout<<sum%10000<<endl; return 0; }
a.cc: In function 'int main()': a.cc:24:14: error: expected primary-expression before ']' token 24 | dp[MM][MM][MM]=1; | ^ a.cc:24:18: error: expected primary-expression before ']' token 24 | dp[MM][MM][MM]=1; | ^ a.cc:24:22: error: expected primary-expression before ']' token 24 | dp[MM][MM][MM]=1; | ^ a.cc:26:47: error: expected primary-expression before '||' token 26 | if((j!=k||k!=kk)&&(sosu[i]==MM||sosu[i]==kk)) { | ^~
s927292469
p00491
C++
#include<cstdio> #include<functional> #include<algorithm> #include<iostream> #include<cstring> #include<string> #include<cstdlib> #include<cctype> #include<queue> #define MM #define rep(i,a) for(int i=0;i<a;i++) #define rep2(i,a) for(int i=1;i<=a;i++) #define rep3(i,a) for(int i=1;i<a;i++) #define rep4(i,a) for(int i=0;i<=a;i++) using namespace std; int dp[110][5][5]; long long int sum; int main(void) { int x,y; int day,al,sosu[110]={MM}; cin>>day>>al; rep(i,al) {cin>>x>>y;sosu[x]=y;} dp[MM][MM][MM]=1; rep2(i,day)rep(j,4)rep(k,4)rep3(kk,4) { if((j!=k||k!=kk)&&(sosu[i]==MM||sosu[i]==kk)) { dp[i][k][kk]+=dp[i-1][j][k]; dp[i][k][kk]%=10000; } } sum=0; rep2(i,3)rep4(j,3) sum+=dp[day][i][j]; cout<<sum%10000<<endl; return 0; }
a.cc: In function 'int main()': a.cc:24:14: error: expected primary-expression before ']' token 24 | dp[MM][MM][MM]=1; | ^ a.cc:24:18: error: expected primary-expression before ']' token 24 | dp[MM][MM][MM]=1; | ^ a.cc:24:22: error: expected primary-expression before ']' token 24 | dp[MM][MM][MM]=1; | ^ a.cc:26:47: error: expected primary-expression before '||' token 26 | if((j!=k||k!=kk)&&(sosu[i]==MM||sosu[i]==kk)) { | ^~
s002196053
p00491
C++
#include<iostream> using namespace std; int dp[105][3][2],a[105],n,m,p,q; int main(){ cin>>n>>m;for(int i=0;i<m;i++){cin>>p>>q;a[p]=q;} if(a[1]==0){dp[1][0][0]=1;dp[1][1][0]=1;dp[1][2][0]=1;} if(a[1]>=1)dp[1][a[i]-1][0]=1; for(int i=2;i<=n;i++){ if(a[i]==0 || a[i]==1){ dp[i][0][0]+=(dp[i-1][1][0]+dp[i-1][1][1]+dp[i-1][2][0]+dp[i-1][2][1]);dp[i][0][0]%=10000; dp[i][0][1]+=dp[i-1][0][0];dp[i][0][1]%=10000; } if(a[i]==0 || a[i]==2){ dp[i][1][0]+=(dp[i-1][0][0]+dp[i-1][0][1]+dp[i-1][2][0]+dp[i-1][2][1]);dp[i][1][0]%=10000; dp[i][1][1]+=dp[i-1][1][0];dp[i][1][1]%=10000; } if(a[i]==0 || a[i]==3){ dp[i][2][0]+=(dp[i-1][0][0]+dp[i-1][0][1]+dp[i-1][1][0]+dp[i-1][1][1]);dp[i][2][0]%=10000; dp[i][2][1]+=dp[i-1][2][0];dp[i][2][1]%=10000; } } cout<<(dp[n][0][0]+dp[n][0][1]+dp[n][1][0]+dp[n][1][1]+dp[n][2][0]+dp[n][2][1])%10000<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:28: error: 'i' was not declared in this scope 7 | if(a[1]>=1)dp[1][a[i]-1][0]=1; | ^