submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s465088302
p03639
C++
#include<iostream> using namespace std; int main() { int n,Ji=1; cin >> n; int a[10]; for (int i = 0; i < n; i++) cin >> a[i]; int z = pow(4, (n - 2)); for (int m = 0; m < n; m++) Ji *= a[m]; if (Ji % z!=0) cout << "No"; else cout << "Yes"; return 0; }
a.cc: In function 'int main()': a.cc:10:17: error: 'pow' was not declared in this scope 10 | int z = pow(4, (n - 2)); | ^~~
s474257340
p03639
C++
#include<iostream> using namespace std; int main() { int N; while (cin >> N) { int *a = new int[N]; int num2 = 0; int num4 = 0; for (int i = 0; i < N; i++) cin >> a[i]; for (int j = 0; j < N; j++) if (a[j] % 2 == 0 && a[j] % 4 != 0) num2++; for (int k = 0; k < N; k++) if (a[k] % 4 == 0) num4++; if (num4 == 0) if (num2 == N) cout << "Yes"; else cout << "No"; if (num4 != 0) { if (num2 != 0) if (num4 >= floor((N - num2 + 1) / 2.0)) cout << "Yes"; else cout << "No"; else if (num4 >= floor(N / 2)) cout << "Yes"; else cout << "No"; } } return 0; }
a.cc: In function 'int main()': a.cc:29:45: error: 'floor' was not declared in this scope 29 | if (num4 >= floor((N - num2 + 1) / 2.0)) | ^~~~~ a.cc:34:45: error: 'floor' was not declared in this scope 34 | if (num4 >= floor(N / 2)) | ^~~~~
s453683554
p03639
C++
#include<iostream> using namespace std; int main() { int N; while (cin >> N) { int *a = new int[N]; int num2 = 0; int num4 = 0; for (int i = 0; i < N; i++) cin >> a[i]; for (int j = 0; j < N; j++) if (a[j] % 2 == 0 && a[j] % 4 != 0) num2++; for (int k = 0; k < N; k++) if (a[k] % 4 == 0) num4++; if (num4 == 0) if (num2 == N) cout << "Yes"; else cout << "No"; if (num4 != 0) { if (num2 != 0) if (num4 >= floor((N - num2 + 1) / 2.0)) cout << "Yes"; else cout << "No"; else if (num4 >= floor(N / 2)) cout << "Yes"; else cout << "No"; } } return 0; }
a.cc: In function 'int main()': a.cc:29:45: error: 'floor' was not declared in this scope 29 | if (num4 >= floor((N - num2 + 1) / 2.0)) | ^~~~~ a.cc:34:45: error: 'floor' was not declared in this scope 34 | if (num4 >= floor(N / 2)) | ^~~~~
s954755804
p03639
C++
#include<iostream> using namespace std; int main() { int N; while (cin >> N) { int *a = new int[N]; int num2 = 0; int num4 = 0; for (int i = 0; i < N; i++) cin >> a[i]; for (int j = 0; j < N; j++) if (a[j] % 2 == 0 && a[j] % 4 != 0) num2++; for (int k = 0; k < N; k++) if (a[k] % 4 == 0) num4++; if (num4 == 0) if (num2 == N) cout << "Yes"; else cout << "No"; if (num4 != 0) { if (num2 != 0) if (num4 >= floor((N - num2 + 1) / 2.0)) cout << "Yes"; else cout << "No"; else if (num4 >= floor(N / 2)) cout << "Yes"; else cout << "No"; } } return 0; }
a.cc: In function 'int main()': a.cc:29:45: error: 'floor' was not declared in this scope 29 | if (num4 >= floor((N - num2 + 1) / 2.0)) | ^~~~~ a.cc:34:45: error: 'floor' was not declared in this scope 34 | if (num4 >= floor(N / 2)) | ^~~~~
s300841675
p03639
C++
#include<iostream> using namespace std; int main() { int N; while (cin >> N) { int *a = new int[N]; int num2 = 0; int num4 = 0; for (int i = 0; i < N; i++) cin >> a[i]; for (int j = 0; j < N; j++) if (a[j] % 2 == 0 && a[j] % 4 != 0) num2++; for (int k = 0; k < N; k++) if (a[k] % 4 == 0) num4++; if (num4 == 0) if (num2 == N) cout << "Yes"; else cout << "No"; if (num4 != 0) { if (num2 != 0) if (num4 >= floor((N - num2 + 1) / 2.0)) cout << "Yes"; else cout << "No"; else if (num4 >= floor(N / 2)) cout << "Yes"; else cout << "No"; } } return 0; }
a.cc: In function 'int main()': a.cc:29:45: error: 'floor' was not declared in this scope 29 | if (num4 >= floor((N - num2 + 1) / 2.0)) | ^~~~~ a.cc:34:45: error: 'floor' was not declared in this scope 34 | if (num4 >= floor(N / 2)) | ^~~~~
s053336283
p03639
C++
#include<iostream> using namespace std; int main() { int N; while (cin >> N) { int *a = new int[N]; int num2 = 0; int num4 = 0; for (int i = 0; i < N; i++) cin >> a[i]; for (int j = 0; j < N; j++) if (a[j] % 2 == 0 && a[j] % 4 != 0) num2++; for (int k = 0; k < N; k++) if (a[k] % 4 == 0) num4++; if (num4 == 0) if (num2 == N) cout << "Yes"; else cout << "No"; if (num4 != 0) { if (num2 != 0) if (num4 >= floor((N - num2 + 1) / 2.0)) cout << "Yes"; else cout << "No"; else if (num4 >= floor(N / 2)) cout << "Yes"; else cout << "No"; } } return 0; }
a.cc: In function 'int main()': a.cc:29:45: error: 'floor' was not declared in this scope 29 | if (num4 >= floor((N - num2 + 1) / 2.0)) | ^~~~~ a.cc:34:45: error: 'floor' was not declared in this scope 34 | if (num4 >= floor(N / 2)) | ^~~~~
s234539962
p03639
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) //* 便利な変数 namespace { int dx4[] = { 1, -1, 0, 0 }; int dy4[] = { 0, 0, 1, -1 }; int dx8[] = { 1, -1, 0, 0, 1, 1, -1, -1 }; int dy8[] = { 0, 0, -1, 1, -1, 1, -1, 1 }; int mDays[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; ll A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z; } template <typename T> vector<T> INP(ll n) { vector<T> x; REP(i, n) { T tmp; cin >> tmp; x.push_back(tmp); } return move(x); } //* n文字1行の文字列を入力,一文字ごとの配列を返す vector<char> SPRIT_STRING(ll n) { string str; cin >> str; vector<char> cs(n); REP(i, n) cs[i] = str[i]; return move(cs); } //* 文字列中から文字列を検索して別の文字列に置換する void strReplace(std::string& str, const std::string& from, const std::string& to) { std::string::size_type pos = 0; while (pos = str.find(from, pos), pos != std::string::npos) { str.replace(pos, from.length(), to); pos += to.length(); } } //* 素数判定 is_prime<unsigned>(N) template<typename T, std::enable_if_t<std::is_unsigned<T>::value, std::nullptr_t> = nullptr> bool is_prime(const T n) { if (n < 4) return n == 2 || n == 3; if (n % 2 == 0 || n % 3 == 0 || (n % 6 != 1 && n % 6 != 5)) return false; for (T i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } //* 組み合わせ計算 inline unsigned long long NChooseK(const unsigned long long& n, const unsigned long long& k) { if (n < k) return 0; if (0 == n) return 0; if (0 == k) return 1; if (n == k) return 1; if (1 == k) return n; typedef unsigned long long value_type; value_type* table = new value_type[static_cast<std::size_t>(n * n)]; std::fill_n(table, n * n, 0); class n_choose_k_impl { public: n_choose_k_impl(value_type* table, const value_type& dimension) : table_(table), dimension_(dimension) {} inline value_type& lookup(const value_type& n, const value_type& k) { return table_[dimension_ * n + k]; } inline value_type compute(const value_type& n, const value_type& k) { if ((0 == k) || (k == n)) return 1; value_type v1 = lookup(n - 1, k - 1); if (0 == v1) v1 = lookup(n - 1, k - 1) = compute(n - 1, k - 1); value_type v2 = lookup(n - 1, k); if (0 == v2) v2 = lookup(n - 1, k) = compute(n - 1, k); return v1 + v2; } value_type* table_; value_type dimension_; }; value_type result = n_choose_k_impl(table, n).compute(n, k); delete[] table; return result; } //* 座標nx, nyがWidth,Heightの領域内にあるかどうかのチェック inline bool rangeCheck2D(int nx, int ny, int Width, int Height) { return nx >= 0 and nx < Width and ny >= 0 and ny < Height; } //* bit全探索 /* for (int i = 0; i < 1<<N; i++) { REP(j, N) if ((1 & i >> j) == 1) {;} } */ // CodeForces // 複雑な条件を全探索する namespace MashaAndBears { int V1, V2, V3, Vm; bool check(int c1, int c2, int c3) { int th = 2 * Vm; if ((c1 > c2) and (c2 > c3) and (V1 <= c1) and (V2 <= c2) and (V3 <= c3) and (2*V1 >= c1) and (2*V2 >= c2) and (2*V3 >= c3) and (Vm <= c3) and (th >= c3) and (th < c2) and (th < c1)) return true; return false; } void MashaAndBears() { cin >> V1 >> V2 >> V3 >> Vm; FOR(i, 1, 210) { FOR(j, 1, 210) { FOR(k, 1, 210) { if (check(i, j, k)) { cout << i << endl << j << endl << k << endl; return; } } } } cout << "-1" << endl; } } namespace agc001a { void agc001a() { cin >> N; vector<int> ls(N*2); REP(i, N*2) cin >> ls[i]; sort(ls.begin(), ls.end()); int cnt = 0; for (int i = 0; i < 2 * N; i += 2) cnt += min(ls[i], ls[i + 1]); cout << cnt << endl; } } namespace arc080a { void arc080a() { cin >> N; int four = 0, two = 0; REP(i, N) { int a; cin >> a; if (a % 4 == 0) four++; if (a % 2 == 0) two++; } if ((four + two / 2) >= N / 2) cout << "Yes" << endl; else cout << "No" << endl; } }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s680170349
p03639
C++
#include <iostream> using namespace std; int n,nr4,nr2; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>x; if(x%4==0) nr4++; else if (x%2==0) nr2++; } n-=nr2; n-=2*nr4; n++; if(n<=0) cout<<"Yes"; else cout<<"No"; cout<<'\n'; return 0; }
a.cc: In function 'int main()': a.cc:10:14: error: 'x' was not declared in this scope 10 | cin>>x; | ^
s932896449
p03639
C++
import core.bitop; import std.algorithm; import std.array; import std.ascii; import std.container; import std.conv; import std.format; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; void main() { int n = readln.chomp.to!int; int[] a = readln.chomp.split.map!(to!int).array; int one = 0; int four = 0; foreach (v; a) { if (v % 4 == 0) { ++four; continue; } if (v % 2 == 0) { continue; } ++one; } writeln = one <= four ? "Yes" : "No"; }
a.cc:1:1: error: 'import' does not name a type 1 | import core.bitop; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import std.algorithm; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import std.array; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import std.ascii; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import std.container; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import std.conv; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import std.format; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: 'import' does not name a type 8 | import std.math; | ^~~~~~ a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:1: error: 'import' does not name a type 9 | import std.range; | ^~~~~~ a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:10:1: error: 'import' does not name a type 10 | import std.stdio; | ^~~~~~ a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:11:1: error: 'import' does not name a type 11 | import std.string; | ^~~~~~ a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:12:1: error: 'import' does not name a type 12 | import std.typecons; | ^~~~~~ a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:14:1: error: '::main' must return 'int' 14 | void main() | ^~~~ a.cc: In function 'int main()': a.cc:16:11: error: 'readln' was not declared in this scope 16 | int n = readln.chomp.to!int; | ^~~~~~ a.cc:17:6: error: structured binding declaration cannot have type 'int' 17 | int[] a = readln.chomp.split.map!(to!int).array; | ^~ a.cc:17:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:17:6: error: empty structured binding declaration a.cc:17:9: error: expected initializer before 'a' 17 | int[] a = readln.chomp.split.map!(to!int).array; | ^ a.cc:21:12: error: 'v' was not declared in this scope 21 | foreach (v; a) { | ^ a.cc:21:15: error: 'a' was not declared in this scope 21 | foreach (v; a) { | ^ a.cc:31:3: error: 'writeln' was not declared in this scope 31 | writeln = one <= four ? "Yes" : "No"; | ^~~~~~~
s445638317
p03639
C++
#include <iostream> using namespace std; int N, a; int odd=0, even=0, multiple4=0; int main(void){ cin >> N; for(int i=0; i<N; i++){ cin >> a; if(a%2) odd++; else if(a%4) even++; else multiple4++; } bool ans = true; if(!even){ if(odd > multiple4+1) ans = false; }else{ if(odd > multiple4) ans = false; } if(ans) cout << "Yes\n"; else cout << "No\n" return 0; }
a.cc: In function 'int main()': a.cc:25:24: error: expected ';' before 'return' 25 | else cout << "No\n" | ^ | ; 26 | 27 | return 0; | ~~~~~~
s987811851
p03639
C++
#include<bits/stdc++.h> using namespace std; #define N 1000100 #define k 100000000 #define F (rt<<1) #define s int #define G (rt<<1|1) #define o first #define u second #define I push_back #define K return #define X void struct J{s a,b,H;}p[N];typedef pair<s,s> pa;bool operator < (J x,J y){if (x.a==y.a) K x.b>y.b;K x.a>y.a;}priority_queue<J> q;s n,i,a[N],A,t[N];pa m[N<<3];vector<s> e[N],ans;X E(pa &x,pa y) {x.o=min(x.o,y.o),x.u=min(x.u,y.u);}X c(s rt,s l,s r){m[rt].o=k;m[rt].u=k;if (l==r){if (l&1) m[rt].o=a[l];else m[rt].u=a[l];K ;}s D=(l+r)/2;c(F,l,D);c(G,D+1,r);E(m[rt],m[F]),E(m[rt],m[G]);}pa b(s rt,s l,s r,s x,s y){if (x<=l&&r<=y) K m[rt];s D=(l+r)/2;pa C=make_pair(k,k);if(x<=D) E(C,b(F,l,D,x,y));if (y>=D+1) E(C,b(G,D+1,r,x,y));K C;}s d(s l,s r){s f,w,h,z;if (l&1){f=b(1,1,n,l,r).o,h=t[f];w=b(1,1,n,h+1,r).u,z=t[w];}else{f=b(1,1,n,l,r).u,h=t[f];w=b(1,1,n,h+1,r).o,z=t[w];}p[++A].a=f,p[A].b=w,p[A].H=A;s B=A;if (h!=l)e[B].I(d(l,h-1));if(h+1!=z)e[B].I(d(h+1,z-1));if (z!=r) e[B].I(d(z+1,r));K B;}s main(){scanf("%d",&n);for (i=1;i<=n;i++)scanf("%d",&a[i]),t[a[i]]=i;c(1,1,n);d(1,n);q.push(p[1]);while (!q.empty()){s x=q.top().H;q.pop();printf("%d %d ",p[x].a,p[x].b);(i=0;i<(s)e[x].size();i++)q.push(p[e[x][i]]);}}
a.cc: In function 'int main()': a.cc:13:963: error: expected ')' before ';' token 13 | struct J{s a,b,H;}p[N];typedef pair<s,s> pa;bool operator < (J x,J y){if (x.a==y.a) K x.b>y.b;K x.a>y.a;}priority_queue<J> q;s n,i,a[N],A,t[N];pa m[N<<3];vector<s> e[N],ans;X E(pa &x,pa y) {x.o=min(x.o,y.o),x.u=min(x.u,y.u);}X c(s rt,s l,s r){m[rt].o=k;m[rt].u=k;if (l==r){if (l&1) m[rt].o=a[l];else m[rt].u=a[l];K ;}s D=(l+r)/2;c(F,l,D);c(G,D+1,r);E(m[rt],m[F]),E(m[rt],m[G]);}pa b(s rt,s l,s r,s x,s y){if (x<=l&&r<=y) K m[rt];s D=(l+r)/2;pa C=make_pair(k,k);if(x<=D) E(C,b(F,l,D,x,y));if (y>=D+1) E(C,b(G,D+1,r,x,y));K C;}s d(s l,s r){s f,w,h,z;if (l&1){f=b(1,1,n,l,r).o,h=t[f];w=b(1,1,n,h+1,r).u,z=t[w];}else{f=b(1,1,n,l,r).u,h=t[f];w=b(1,1,n,h+1,r).o,z=t[w];}p[++A].a=f,p[A].b=w,p[A].H=A;s B=A;if (h!=l)e[B].I(d(l,h-1));if(h+1!=z)e[B].I(d(h+1,z-1));if (z!=r) e[B].I(d(z+1,r));K B;}s main(){scanf("%d",&n);for (i=1;i<=n;i++)scanf("%d",&a[i]),t[a[i]]=i;c(1,1,n);d(1,n);q.push(p[1]);while (!q.empty()){s x=q.top().H;q.pop();printf("%d %d ",p[x].a,p[x].b);(i=0;i<(s)e[x].size();i++)q.push(p[e[x][i]]);}} | ~ ^ | ) a.cc:13:984: error: expected ';' before ')' token 13 | struct J{s a,b,H;}p[N];typedef pair<s,s> pa;bool operator < (J x,J y){if (x.a==y.a) K x.b>y.b;K x.a>y.a;}priority_queue<J> q;s n,i,a[N],A,t[N];pa m[N<<3];vector<s> e[N],ans;X E(pa &x,pa y) {x.o=min(x.o,y.o),x.u=min(x.u,y.u);}X c(s rt,s l,s r){m[rt].o=k;m[rt].u=k;if (l==r){if (l&1) m[rt].o=a[l];else m[rt].u=a[l];K ;}s D=(l+r)/2;c(F,l,D);c(G,D+1,r);E(m[rt],m[F]),E(m[rt],m[G]);}pa b(s rt,s l,s r,s x,s y){if (x<=l&&r<=y) K m[rt];s D=(l+r)/2;pa C=make_pair(k,k);if(x<=D) E(C,b(F,l,D,x,y));if (y>=D+1) E(C,b(G,D+1,r,x,y));K C;}s d(s l,s r){s f,w,h,z;if (l&1){f=b(1,1,n,l,r).o,h=t[f];w=b(1,1,n,h+1,r).u,z=t[w];}else{f=b(1,1,n,l,r).u,h=t[f];w=b(1,1,n,h+1,r).o,z=t[w];}p[++A].a=f,p[A].b=w,p[A].H=A;s B=A;if (h!=l)e[B].I(d(l,h-1));if(h+1!=z)e[B].I(d(h+1,z-1));if (z!=r) e[B].I(d(z+1,r));K B;}s main(){scanf("%d",&n);for (i=1;i<=n;i++)scanf("%d",&a[i]),t[a[i]]=i;c(1,1,n);d(1,n);q.push(p[1]);while (!q.empty()){s x=q.top().H;q.pop();printf("%d %d ",p[x].a,p[x].b);(i=0;i<(s)e[x].size();i++)q.push(p[e[x][i]]);}} | ^ | ;
s452815222
p03639
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner s=new Scanner(System.in); int a=s.nextInt(); int b; int ans=1; int cnt=0; do{ b=s.nextInt(); ans*=b; cnt++; }while(cnt<a); if(ans%math.paw(4,a/2)==0) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:14: error: cannot find symbol if(ans%math.paw(4,a/2)==0) ^ symbol: variable math location: class Main 1 error
s902864612
p03639
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner s=new Scanner(System.in); int a=s.nextInt(); int b; int ans=1; int cnt=0; do{ b=s.nextInt(); ans*=b; cnt++; }while(cnt<a); if(ans%math.paw(4,n/2)==0) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:14: error: cannot find symbol if(ans%math.paw(4,n/2)==0) ^ symbol: variable n location: class Main Main.java:14: error: cannot find symbol if(ans%math.paw(4,n/2)==0) ^ symbol: variable math location: class Main 2 errors
s556968191
p03639
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner s=new Scanner(System.in); int a=s.nextInt(); int b; int ans=1; int cnt=0; do{ b=s.nextInt(); ans*=b; cnt++; }while(cnt<n); if(ans%math.paw(4,n/2)==0) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:13: error: cannot find symbol }while(cnt<n); ^ symbol: variable n location: class Main Main.java:14: error: cannot find symbol if(ans%math.paw(4,n/2)==0) ^ symbol: variable n location: class Main Main.java:14: error: cannot find symbol if(ans%math.paw(4,n/2)==0) ^ symbol: variable math location: class Main 3 errors
s787962748
p03639
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner s=new Scanner(System.in); int a=s.nextInt(); int b; int ans=1; int cnt=0; do{ b=s.nextInt(); ans*=b; cnt++; }while(cnt<n); if(ans%math.paw(4,n/2)==0) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:13: error: cannot find symbol }while(cnt<n); ^ symbol: variable n location: class Main Main.java:14: error: cannot find symbol if(ans%math.paw(4,n/2)==0) ^ symbol: variable n location: class Main Main.java:14: error: cannot find symbol if(ans%math.paw(4,n/2)==0) ^ symbol: variable math location: class Main 3 errors
s697574355
p03639
Java
import java.util.*; class Main{ public static void main(String[] args){ Scanner s=new Scanner(System.in); int a=s.nextInt(); int b; int ans=1; int cnt=0; do{ b=s.nextInt(); ans*=b; cnt++; }while(cnt<n); if(ans%math.paw(4,n/2) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:14: error: ')' expected if(ans%math.paw(4,n/2) ^ 1 error
s887667239
p03639
C++
#include <iostream> using namespace std; int main() { int n; cin>>n; int pre=0; cin>>pre; for(int i=1;i<n;i++) { int temp; cin>>temp; if((pre+temp)%4) { cout<<"NO"<<endl;reuturn 0; } pre=temp; } cout<<"Yes"<<endl;return 0; }
a.cc: In function 'int main()': a.cc:17:24: error: 'reuturn' was not declared in this scope 17 | cout<<"NO"<<endl;reuturn 0; | ^~~~~~~
s159054328
p03639
C++
#include <iostream> using namespace std; int main() { int n; cin>>n; int pre=0; cin>>pre; for(int i=1;i<n;i++) { int temp; cin>>temp; if((pre+temp)%4) { cout<<"NO"<<endl;reuturn 0; } } cout<<"Yes"<<endl;return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'if\U0000ff08' was not declared in this scope 15 | if((pre+temp)%4) | ^~~~ a.cc:15:20: error: unable to find numeric literal operator 'operator""\U0000ff09' 15 | if((pre+temp)%4) | ^~~
s324987132
p03639
C++
#include <iostream> using namespace std; int main() { int n; cin>>n; int pre=0; cin>>pre; for(int i=1;i<n;i++) { int temp; cin>>temp; if(pre+temp)%4 { cout<<"NO"<<endl;reuturn 0; } } cout<<"Yes"<<endl;return 0; }
a.cc: In function 'int main()': a.cc:15:17: error: expected primary-expression before '%' token 15 | if(pre+temp)%4 | ^
s003412134
p03639
C++
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n; int p = 0; int ne = 0; int c = 0; n = cin.nextInt(); int sk; for(int j = 0;j<n;j++){ sk = cin.nextInt(); if(sk%4==0){ c++; } else if(sk%2==0){ p++; } else{ ne++; } } if(p%2==0){ n-=p; } else{ if(c>0){ n-=p; n--; c--; } else if(p != n){ System.out.println("No"); return; } } if(n%2==0){ if(c>=ne){ System.out.println("Yes"); } else{ System.out.println("No"); } } else{ if(c+1 >= ne){ System.out.println("Yes"); } else{ System.out.println("No"); } } } }
a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main{ | ^~~~~~
s553697748
p03639
Java
package atcoder; import java.util.Scanner; public class F { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int nNum = in.nextInt(); int cnt4 = 0; int cnt2 = 0; while(in.hasNextInt()) { int val = in.nextInt(); if(val % 4 == 0) cnt4++; if(val % 4 != 0 && val % 2 == 0) cnt2++; } nNum -= cnt2 / 2; if(nNum / 2 <= cnt4) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:5: error: class F is public, should be declared in a file named F.java public class F { ^ 1 error
s475369121
p03639
Java
public class Main { private static int N; private static int a[]; private static int count4 = 0; private static int count2 = 0; public static void input(){ Scanner scan = new Scanner(System.in); N = scan.nextInt(); a = new int[N]; for(int i=0;i<N;i++) { a[i] = scan.nextInt(); if(a[i] % 4 == 0) count4++; //4の倍数の個数をカウント else if(a[i] % 2 == 0) count2++; //2の倍数をカウント } } public static void main(String args[]){ //入力 input(); if(count4 + count2/2 > N/2) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:9: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:9: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s403901087
p03639
C++
// workspace.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include<iostream> #include<vector> #include "stdafx.h" using namespace std; int main() { int n; cin >> n; int odd = 0; int even = 0; int forth = 0; for (int i = 0; i < n; i++) { int x; cin >> x; if (x % 2 == 0) { if (x % 4 == 0)forth++; else even++; } else odd++; } if (odd <= forth) { cout << "Yes" << endl; } else if (odd - 1 == forth && even == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
a.cc:5:10: fatal error: stdafx.h: No such file or directory 5 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s254383896
p03639
C++
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define Max(x,y,z) max(x,max(y,z)) #define Min(x,y,z) min(x,min(y,z)) #define fr(i,s,e) for(i=s;i<e;i++) #define rf(i,s,e) for(i=s-1;i>=e;i--) #define pb push_back #define eb emblace_back #define mp make_pair #define ff first #define ss second #define trace1(x) cerr<<#x<<": "<<x<<endl #define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl #define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl #define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl #define trace5(a, b, c, d, e) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl typedef long long ll; typedef long double ld; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef vector<vvvi> vvvvi; typedef vector<long long> vll; typedef vector<vll> vvll; typedef vector<vvll> vvvll; typedef vector<vvvll> vvvvll; typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<vvc> vvvc; typedef vector<pair<long long,long long> > vpll; typedef vector<vector<pair<ll,ll> > > vvpll; typedef vector<bool> vb; typedef vector<vb> vvb; #define PI 3.141592653589793 #define MOD 1000000007 template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; } int main() { IOS; ll n; cin>>n; vll v(n); for(ll i=0;i<n;i++) { cin>>v[i]; } vll a(5,0); for(ll i=0;i<n;i++) { if(v[i]%2) { a[1]++; } else if( { if(v[i]%4==0) { a[4]++; } else { a[2]++; } } } if(a[2]>0) { a[1]++; } if(a[1]<=a[4]+1) { cout<<"Yes"; } else { cout<<"No"; } return 0; }
a.cc: In function 'int main()': a.cc:69:17: error: expected primary-expression before '{' token 69 | { | ^ a.cc:68:25: error: expected ')' before '{' token 68 | else if( | ~^ | ) 69 | { | ~ a.cc:79:9: error: expected primary-expression before '}' token 79 | } | ^
s236991665
p03639
C++
#include<iostream> #include<vector> #include<math.h> #include<map> #include<queue> #include<algorithm> #include<functional> using namespace std; #define INF int(1e9) #define N 100000 #define MP make_pair typedef pair<int, int> P; typedef pair<pair<P, int>, P>PP; int n, a, b; P *mia, *mib; P seg1[4 * (2 * N + 1)], seg2[4 * (2 * N + 1)]; priority_queue<PP, vector<PP>, greater<PP> > pq; void init(P aa[], int nn) { n = 1; while (n < nn) n *= 2; for (int i = 0; i < n * 2 - 1; i++) aa[i] = MP(INF,INF); } void update(P aa[], int k, int c, int nn) { int num = k; k += nn - 1; aa[k] = MP(c, num); int cc = nn; while (k != 0) { k = (k - 1) / 2; if (aa[k].first <= c) break; aa[k] = MP(c, num); } } P* query(int s, int e, int k, int l, int r, P aa[]) { if (r <= s || l >= e) return NULL; if (r <= e && s <= l) { return aa + k; } else { P* vl = query(s, e, k * 2 + 1, l, (l + r) / 2, aa); P* vr = query(s, e, k * 2 + 2, (l + r) / 2, r, aa); if (vl == NULL) { if (vr == NULL) { return NULL; } else { return vr; } } if (vr == NULL) { return vl; } return *vl < *vr ? vl : vr; } } bool solve2(int s, int e) { if (e - s <= 0) { return false; } if (s % 2) { mia = query(s, e, 0, 0, n, seg2); if ((*mia).first == INF) { return false; } mib = query((*mia).second, e, 0, 0, n, seg1); } else { mia = query(s , e, 0, 0, n, seg1); if ((*mia).first == INF) { return false; } mib = query((*mia).second, e, 0, 0, n, seg2); } return true; } void solve() { if (pq.empty()) { return; } cout << pq.top().first.first.first << " " << pq.top().first.second << " "; int s = pq.top().second.first, e = pq.top().second.second, se = pq.top().first.first.second, es = pq.top().first.second; pq.pop(); if (solve2(s, se)) { pq.push(MP(MP(*mia, (*mib).second), MP(s, se))); } if (solve2(se + 1, es)) { pq.push(MP(MP(*mia, (*mib).second), MP(se + 1, es))); } if (solve2(es + 1, e)) { pq.push(MP(MP(*mia, (*mib).second), MP(es + 1, e))); } solve(); } int main() { cin >> n; int nn = n; init(seg1, n); init(seg2, n); for (int i = 0; i < nn; i+=2) { cin >> a >> b; update(seg1, i, a, n); update(seg2, i + 1, b, n); } if (solve2(0, n)) { pq.push(MP(MP(*mia, *mib), MP(0, n))); } solve(); cout << endl; }
a.cc: In function 'int main()': a.cc:139:24: error: no matching function for call to 'std::priority_queue<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >, std::vector<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > >, std::greater<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > > >::push(std::pair<std::pair<std::pair<int, int>, std::pair<int, int> >, std::pair<int, int> >)' 139 | pq.push(MP(MP(*mia, *mib), MP(0, n))); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/queue:66, from a.cc:5: /usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >; _Sequence = std::vector<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > >; _Compare = std::greater<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > >; value_type = std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >]' 736 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:736:30: note: no known conversion for argument 1 from 'std::pair<std::pair<std::pair<int, int>, std::pair<int, int> >, std::pair<int, int> >' to 'const std::priority_queue<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >, std::vector<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > >, std::greater<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > > >::value_type&' {aka 'const std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >&'} 736 | push(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >; _Sequence = std::vector<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > >; _Compare = std::greater<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > >; value_type = std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >]' 744 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:744:25: note: no known conversion for argument 1 from 'std::pair<std::pair<std::pair<int, int>, std::pair<int, int> >, std::pair<int, int> >' to 'std::priority_queue<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >, std::vector<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > >, std::greater<std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> > > >::value_type&&' {aka 'std::pair<std::pair<std::pair<int, int>, int>, std::pair<int, int> >&&'} 744 | push(value_type&& __x) | ~~~~~~~~~~~~~^~~
s488261198
p03639
C
#include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); for (auto& e : a) { cin >> e; } int c2 = 0; int c4 = 0; for (auto e : a) { if (e % 4 == 0) { c4++; } else if (e % 2 == 0) { c2++; } } if ((c2 > 0 && c4 >= (n - c4)) || c4 > (n - c4)) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s111458846
p03639
C++
hoge
a.cc:1:1: error: 'hoge' does not name a type 1 | hoge | ^~~~
s035842579
p03639
C++
n=input() l=map(int,raw_input().split()) f=0 t=0 o=0 for i in l: if i%4==1 or i%4==3: o+=1 elif i%4==2: t+=1 else: f+=1 if t==0: if f>=n/2: ans="Yes" else: ans="No" else: if o<=f: ans="Yes" else: ans="No" print ans
a.cc:1:1: error: 'n' does not name a type 1 | n=input() | ^
s586482824
p03639
Java
two n | n `mod` 2 == 0 = 1 + two (n `div` 2) | otherwise = 0 main = do ln1 <- getLine ln2 <- getLine let n = read ln1 ar = map (two .read) (words ln2) two_cnt = length (filter (>= 2) ar) zero_cnt = length (filter (== 0) ar) ans = if two_cnt >= zero_cnt || two_cnt == zero_cnt - 1 && two_cnt + zero_cnt == n then "Yes" else "No" in putStrLn ans
Main.java:1: error: class, interface, enum, or record expected two n | n `mod` 2 == 0 = 1 + two (n `div` 2) ^ Main.java:1: error: illegal character: '`' two n | n `mod` 2 == 0 = 1 + two (n `div` 2) ^ Main.java:1: error: illegal character: '`' two n | n `mod` 2 == 0 = 1 + two (n `div` 2) ^ Main.java:1: error: illegal character: '`' two n | n `mod` 2 == 0 = 1 + two (n `div` 2) ^ Main.java:1: error: illegal character: '`' two n | n `mod` 2 == 0 = 1 + two (n `div` 2) ^ 5 errors
s432859301
p03639
C++
#include <iostream> using namespace std; int main(int argc, char* argv[]) { int n = argc; bool flag = false; int n4 = 0; int n2 = 0; for (auto i = 0; i < n; ++i) { if (static_cast<int>(*argv[i]) % 4 == 0) { ++n4; } if (static_cast<int>(*argv[i]) % 4 != 0 && static_cast<int>(*argv[i]) % 2 == 0) { ++n2; } } int n1 = n - n4 - n2; if (n2 > 0) { ++n1; } if (n4 > 0) { if (n4 + 1 >= n1) { flag = true; } else { flag = true; } if (flag) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:40:2: error: expected '}' at end of input 40 | } | ^ a.cc:5:34: note: to match this '{' 5 | int main(int argc, char* argv[]) { | ^
s095772230
p03639
C++
#include <iostream> using namespace std; int main(int argc, char* argv[]) { int n = argc; bool flag = false; int n4 = 0; for (auto i = 0; i < n; ++i) { if (*static_cast<int*>(argv[i]) % 4 == 0) { ++n4; } } if (n4 >= n / 2) { flag = true; } if (flag) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:12:6: error: invalid 'static_cast' from type 'char*' to type 'int*' 12 | if (*static_cast<int*>(argv[i]) % 4 == 0) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~
s118742054
p03639
C++
#include <iostream> using namespace std; int main(int argc, char* argv[]) { int n = argc; bool flag = false; int n4 = 0; for (auto i = 0; i < n; ++i) { if (argv[i] % 4 == 0) { ++n4; } } if (n4 >= n / 2) { flag = true; } if (flag) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
a.cc: In function 'int main(int, char**)': a.cc:12:13: error: invalid operands of types 'char*' and 'int' to binary 'operator%' 12 | if (argv[i] % 4 == 0) { | ~~~~~~~ ^ ~ | | | | | int | char*
s924903571
p03639
C++
#include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif #pragma comment(linker, "/STACK:1024000000,1024000000") #define MOD 1000000007 #define INF 0x3f3f3f3f #define EPS 1e-10 #define set0(x) memset((x),0,sizeof(x)) #define setINF(x) memset((x),63,sizeof(x)) #define MP make_pair #define X first #define L second.first #define R second.second using namespace std; int n,a[2][100005],pos[100005],mi[2][100005][20]; typedef pair<int,pair<int,int> > pip; priority_queue<pip,vector<pip>,greater<pip> > pq; inline int query(int k,int l,int r){ int lb=0,ub=lg+1; while(ub-lb>1){ int mid=(lb+ub)>>1; if(r-l+1>=(1<<mid))lb=mid; else ub=mid; } return min(mi[k][l][lb],mi[k][r-(1<<lb)+1][lb]); } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin>>n; for(int i=0;i<n;i++){ int x; cin>>x; pos[x]=i; a[i&1][i]=x; a[(i&1)^1][i]=INF; } //RMQ Init for(int k=0;k<2;k++){ for(int i=0;i<n;i++){ mi[k][i][0]=a[k][i]; } for(int j=1;(1<<j)<=n;j++){ for(int i=0;(i+(1<<j)-1)<n;i++){ mi[k][i][j]=min(mi[k][i][j-1],mi[k][i+(1<<(j-1))][j-1]); } } } pq.push(MP(query(0,0,n-1),MP(0,n-1))); while(!pq.empty()){ pip u=pq.top(); pq.pop(); int q1=u.X,q2=query((pos[u.X]&1)^1,pos[u.X]+1,u.R); cout<<q1<<' '<<q2<<' '; if(u.L<pos[q1])pq.push(MP(query(u.L&1,u.L,pos[q1]-1),MP(u.L,pos[q1]-1))); if(pos[q1]+1<pos[q2])pq.push(MP(query((pos[q1]+1)&1,pos[q1]+1,pos[q2]-1),MP(pos[q1]+1,pos[q2]-1))); if(pos[q2]<u.R)pq.push(MP(query((pos[q2]+1)&1,pos[q2]+1,u.R),MP(pos[q2]+1,u.R))); } return 0; }
a.cc: In function 'int query(int, int, int)': a.cc:95:21: error: 'lg' was not declared in this scope; did you mean 'lb'? 95 | int lb=0,ub=lg+1; | ^~ | lb
s931470121
p03639
C++
#include <iostream> #include <ostream> #include <cstdio> #include <vector> #include <algorithm> #include <utility> #include <queue> using namespace std; template<class T> void show(vector<T> &v) { if (!v.empty()) { copy(v.begin(), v.end(), ostream_iterator<T>(cout, " ")); } cout << endl; } class AAA { public: int x; int y; int x_idx; int y_idx; vector<int> v; AAA(vector<int> &vv) { v = vv; if (v.empty()) { x = y = x_idx = y_idx = -1; return; } x_idx = 0; x = v[x_idx]; for (int i = 2; i < v.size(); i += 2) { if (v[i] < x) { x = v[i]; x_idx = i; } } y_idx = x_idx + 1; y = v[y_idx]; for (int i = y_idx + 2; i < v.size(); i+= 2) { if (v[i] < y) { y = v[i]; y_idx = i; } } // printf("xy %d %d, idx %d %d\n", x, y, x_idx, y_idx); } }; bool operator < (const AAA &a, const AAA &b) { return a.x < b.x; } bool operator > (const AAA &a, const AAA &b) { return a.x > b.x; } int main() { int n; cin >> n; vector<int> p(n, 0); for (int i = 0; i < n; i++) { cin >> p[i]; } priority_queue<AAA, vector<AAA>, greater<AAA>> que; vector<int> ans; AAA aaa(p); que.push(aaa); while(!que.empty()) { auto a = que.top(); que.pop(); ans.emplace_back(a.x); ans.emplace_back(a.y); auto v = a.v; // cout << "ans: "; // show(ans); // cout << "v : "; // show(v); auto v1 = vector<int>(v.begin(), v.begin() + a.x_idx); auto v2 = vector<int>(v.begin() + a.x_idx + 1, v.begin() + a.y_idx); auto v3 = vector<int>(v.begin() + a.y_idx + 1, v.end()); if (!v1.empty()) { que.push(AAA(v1)); } if (!v2.empty()) { que.push(AAA(v2)); } if (!v3.empty()) { que.push(AAA(v3)); } // cout << "-----" << endl; // show(v1); // cout << a.x << endl; // show(v2); // cout << a.y << endl; // show(v3); // cout << "....." << endl; } show(ans); return 0; }
a.cc: In function 'void show(std::vector<_Tp>&)': a.cc:15:42: error: 'ostream_iterator' was not declared in this scope 15 | copy(v.begin(), v.end(), ostream_iterator<T>(cout, " ")); | ^~~~~~~~~~~~~~~~ a.cc:8:1: note: 'std::ostream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>' 7 | #include <queue> +++ |+#include <iterator> 8 | a.cc:15:60: error: expected primary-expression before '>' token 15 | copy(v.begin(), v.end(), ostream_iterator<T>(cout, " ")); | ^
s142643804
p03639
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class ABC069 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int odd = 0, multiple4 = 0; for (int i = 0; i < n; i++) { int x = sc.nextInt(); if(x%2 == 1) odd++; if(x%4 == 0) multiple4++; } if((odd <= multiple4 + 1 && odd+multiple4 == n)) System.out.println("Yes"); else if(odd > multiple4 ) System.out.println("No"); else System.out.println("Yes"); } static class Scanner{ StringTokenizer st;BufferedReader br; public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));} public String next() throws IOException {while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());return st.nextToken();} public int nextInt() throws IOException {return Integer.parseInt(next());} public long nextLong() throws IOException {return Long.parseLong(next());} public String nextLine() throws IOException {return br.readLine();} public double nextDouble() throws IOException {return Double.parseDouble(next());} public boolean ready() throws IOException {return br.ready();} } }
Main.java:7: error: class ABC069 is public, should be declared in a file named ABC069.java public class ABC069 ^ 1 error
s450198577
p03639
C++
using namespace std; #include <vector> int main() { int size = 0; cin >> size; int next = 0; int i = 0; vector<int> vec(size, 0); while (i<size) { cin >> next; vec[i] = next; i++; } bool b = 1; for (int i = 0; i < size-1; i++) { int temp = vec[i] * vec[i + 1]; if (temp % 4 != 0 || temp < 4) b = 0; } if (!b) cout << "No"; else cout << "Yes"; return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'cin' was not declared in this scope 7 | cin >> size; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <vector> +++ |+#include <iostream> 3 | a.cc:20:17: error: 'cout' was not declared in this scope 20 | if (!b) cout << "No"; | ^~~~ a.cc:20:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:21:14: error: 'cout' was not declared in this scope 21 | else cout << "Yes"; | ^~~~ a.cc:21:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s237255707
p03639
Java
public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int fC=0; int oC=0,eC=0; int t=N; while (t-- > 0) { int n=sc.nextInt(); if(n%4==0) fC++; else if(n%2==0) eC++; else oC++; } if(eC>0)oC++; if(oC-1<=fC||oC==0) System.out.println("Yes"); else System.out.println("No"); } }
Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s442858563
p03639
C++
#include <cstdio> #include <algorithm> #include <set> #include <utility> static const int MAXN = 2e5 + 4; int n; int a[MAXN], p[MAXN]; int b[MAXN], top = 0; struct rmq { static const int LOGN = 18; std::pair<int, int> f[LOGN][MAXN]; inline void build(int n, int *a) { for (int i = 0; i < n; ++i) f[0][i] = std::make_pair(a[i], i); for (int j = 1; j < LOGN; ++j) for (int i = 0; i <= n - (1 << j); ++i) f[j][i] = std::min(f[j - 1][i], f[j - 1][i + (1 << (j - 1))]); } inline std::pair<int, int> query(int l, int r) { if (l == r) return f[0][l]; int sz = 8 * sizeof(int) - __builtin_clz(r - l) - 1; return std::min(f[sz][l], f[sz][r - (1 << sz) + 1]); } } all, even, odd; struct cmp_peek { inline bool operator ()(const std::pair<int, int> a, const std::pair<int, int> b) { int ua = ((a.first & 1) ? odd : even).query(a.first, a.second).first; int ub = ((b.first & 1) ? odd : even).query(b.first, b.second).first; return ua < ub; } }; std::set<std::pair<int, int>, cmp_peek> s; void solve(int l, int r) { auto u = ((l & 1) ? odd : even).query(l, r); auto v = ((r & 1) ? odd : even).query(l, r); int pu = u.second, pv = v.second; b[top++] = u.first; b[top++] = v.first; if (l <= pu - 1) s.insert(std::make_pair(l, pu - 1)); if (pu + 1 <= pv - 1) s.insert(std::make_pair(pu + 1, pv - 1)); if (pv + 1 <= r) s.insert(std::make_pair(pv + 1, r)); } int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &a[i]), p[--a[i]] = i; all.build(n, a); for (int i = 0; i < n; ++i) b[i] = (i & 1) ? MAXN : a[i]; even.build(n, b); for (int i = 0; i < n; ++i) b[i] = (i & 1) ? a[i] : MAXN; odd.build(n, b); s.insert(std::make_pair(0, n - 1)); while (!s.empty()) { auto r = *s.begin(); s.erase(s.begin()); solve(r.first, r.second); } for (int i = 0; i < n; ++i) printf("%d%c", b[i] + 1, i == n - 1 ? '\n' : ' '); return 0; }
In file included from /usr/include/c++/14/set:62, from a.cc:3: /usr/include/c++/14/bits/stl_tree.h: In instantiation of 'static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(_Const_Link_type) [with _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; _Const_Link_type = const std::_Rb_tree_node<std::pair<int, int> >*]': /usr/include/c++/14/bits/stl_tree.h:2116:47: required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; key_type = std::pair<int, int>]' 2116 | __comp = _M_impl._M_key_compare(__k, _S_key(__x)); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:2169:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = std::pair<int, int>; _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >]' 2169 | = _M_get_insert_unique_pos(_KeyOfValue()(__v)); | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:523:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = std::pair<int, int>; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, cmp_peek, std::allocator<std::pair<int, int> > >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<std::pair<int, int> >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::rebind<std::pair<int, int> >; typename _Alloc::value_type = std::pair<int, int>; value_type = std::pair<int, int>]' 523 | _M_t._M_insert_unique(std::move(__x)); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ a.cc:45:30: required from here 45 | if (l <= pu - 1) s.insert(std::make_pair(l, pu - 1)); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:768:15: error: static assertion failed: comparison object must be invocable as const 768 | is_invocable_v<const _Compare&, const _Key&, const _Key&>, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:768:15: note: 'std::is_invocable_v<const cmp_peek&, const std::pair<int, int>&, const std::pair<int, int>&>' evaluates to false
s183172537
p03639
C++
#include <cstdio> #include <algorithm> #include <set> #include <utility> static const int MAXN = 2e5 + 4; int n; int a[MAXN], p[MAXN]; int b[MAXN], top = 0; struct rmq { static const int LOGN = 18; std::pair<int, int> f[LOGN][MAXN]; inline void build(int n, int *a) { for (int i = 0; i < n; ++i) f[0][i] = std::make_pair(a[i], i); for (int j = 1; j < LOGN; ++j) for (int i = 0; i <= n - (1 << j); ++i) f[j][i] = std::min(f[j - 1][i], f[j - 1][i + (1 << (j - 1))]); } inline std::pair<int, int> query(int l, int r) { if (l == r) return f[0][l]; int sz = 8 * sizeof(int) - __builtin_clz(r - l) - 1; return std::min(f[sz][l], f[sz][r - (1 << sz) + 1]); } } all, even, odd; struct cmp_peek { inline bool operator ()(const std::pair<int, int>& a, const std::pair<int, int>& b) { int ua = ((a.first & 1) ? odd : even).query(a.first, a.second).first; int ub = ((b.first & 1) ? odd : even).query(b.first, b.second).first; return ua < ub; } }; std::set<std::pair<int, int>, cmp_peek> s; void solve(int l, int r) { auto u = ((l & 1) ? odd : even).query(l, r); auto v = ((r & 1) ? odd : even).query(l, r); int pu = u.second, pv = v.second; b[top++] = u.first; b[top++] = v.first; if (l <= pu - 1) s.insert(std::make_pair(l, pu - 1)); if (pu + 1 <= pv - 1) s.insert(std::make_pair(pu + 1, pv - 1)); if (pv + 1 <= r) s.insert(std::make_pair(pv + 1, r)); } int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &a[i]), p[--a[i]] = i; all.build(n, a); for (int i = 0; i < n; ++i) b[i] = (i & 1) ? MAXN : a[i]; even.build(n, b); for (int i = 0; i < n; ++i) b[i] = (i & 1) ? a[i] : MAXN; odd.build(n, b); s.insert(std::make_pair(0, n - 1)); while (!s.empty()) { auto r = *s.begin(); s.erase(s.begin()); solve(r.first, r.second); } for (int i = 0; i < n; ++i) printf("%d%c", b[i] + 1, i == n - 1 ? '\n' : ' '); return 0; }
In file included from /usr/include/c++/14/set:62, from a.cc:3: /usr/include/c++/14/bits/stl_tree.h: In instantiation of 'static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(_Const_Link_type) [with _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; _Const_Link_type = const std::_Rb_tree_node<std::pair<int, int> >*]': /usr/include/c++/14/bits/stl_tree.h:2116:47: required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; key_type = std::pair<int, int>]' 2116 | __comp = _M_impl._M_key_compare(__k, _S_key(__x)); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:2169:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = std::pair<int, int>; _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >]' 2169 | = _M_get_insert_unique_pos(_KeyOfValue()(__v)); | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:523:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = std::pair<int, int>; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, cmp_peek, std::allocator<std::pair<int, int> > >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<std::pair<int, int> >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::rebind<std::pair<int, int> >; typename _Alloc::value_type = std::pair<int, int>; value_type = std::pair<int, int>]' 523 | _M_t._M_insert_unique(std::move(__x)); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ a.cc:45:30: required from here 45 | if (l <= pu - 1) s.insert(std::make_pair(l, pu - 1)); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:768:15: error: static assertion failed: comparison object must be invocable as const 768 | is_invocable_v<const _Compare&, const _Key&, const _Key&>, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:768:15: note: 'std::is_invocable_v<const cmp_peek&, const std::pair<int, int>&, const std::pair<int, int>&>' evaluates to false
s164025953
p03639
C
#include <iostream> #include <cstdio> using namespace std; int main(){ int N; int box[3] = {0}; cin >> N; for(int i = 0; i < N; ++i){ int a; scanf("%d", &a); if(a % 4 == 0){ box[2]++; }else if(a % 2 == 0){ box[1]++; }else{ box[0]++; } } if((box[1] >= 1 && box[0] <= box[2]) || (box[1] == 0 && box[0] - 1 <= box[2])){ printf("Yes\n"); }else{ printf("No\n"); } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s961084084
p03639
C++
#include<cmath> #include<math.h> #include<ctype.h> #include<algorithm> #include<bitset> #include<cassert> #include<cctype> #include<cerrno> #include<cfloat> #include<ciso646> #include<climits> #include<clocale> #include<complex> #include<csetjmp> #include<csignal> #include<cstdarg> #include<cstddef> #include<cstdio> #include<cstdlib> #include<cstring> #include<ctime> #include<cwchar> #include<cwctype> #include<deque> #include<exception> #include<fstream> #include<functional> #include<iomanip> #include<ios> #include<iosfwd> #include<iostream> #include<istream> #include<iterator> #include<limits> #include<list> #include<locale> #include<map> #include<memory> #include<new> #include<numeric> #include<ostream> #include<queue> #include<set> #include<sstream> #include<stack> #include<stdexcept> #include<streambuf> #include<string> #include<typeinfo> #include<utility> #include<valarray> #include<vector> #include<string.h> #include<stdlib.h> #include<stdio.h> #include<bits/stdc++.h> using namespace std; int n,m[100001],k; int main() { cin>>n; k=2*n-2; int a=0,b=0,c=0; for(int i=1;i<=n;i++) { cin>>m[i]; if(m[i]%4==0) { k=k-2; } else if(m[i]%2==0) { k=k-1; a++; } else { b++; } } if(a=<b) k++; if(k<n) { cout<<"Yes"; } else { cout<<"No"; } return 0; }
a.cc: In function 'int main()': a.cc:81:14: error: expected primary-expression before '<' token 81 | if(a=<b) | ^
s690474272
p03639
C++
#include<cstdio> using namespace std; int main() { int n; scanf("%d",&n); int jishu=0,oushu=0,four=0; for(int i=1;i<=n;i++) { int cache; scanf("%d",&cache); if(cache%2) jishu++; else if(cache%4) oushu++; else four++; } if(oushu%2==0&&jishu-1<=four) { printf("Yes"); goto mark; } if(oushu%2!=0&&jishu==four) { printf("Yes"); goto mark; } if(jishu==0&&oushu==0) { printf("Yes"); goto mark; } if(oushu%2==0&&jishu==0&&four==0) { printf("Yes"); goto mark; } if(ou) printf("No"); mark:return 0; }
a.cc: In function 'int main()': a.cc:36:12: error: 'ou' was not declared in this scope; did you mean 'four'? 36 | if(ou) | ^~ | four
s331212254
p03639
C++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <string> #include <cmath> #include <vector> #include <list> using namespace std; void getP(vector<int> &p1, vector<int> &p2, int n) { int buf; for (int i = 0; i < n/2; i++) { scanf("%d", &buf); p1[i] = buf; scanf("%d", &buf); p2[i] = buf; } } list<pair<int, int>> mergeVector(list<pair<int, int>> &v1, list<pair<int, int>> &v2) { int n = v1.size() + v2.size(); list<pair<int, int>>::iterator it1 = v1.begin(); list<pair<int, int>>::iterator it2 = v2.begin(); pair<int, int> buf; list<pair<int, int>> result; for (int i = 0; i < n; i++) { if (it1 != v1.end()) { if (it2 != v2.end()) { if (*it1 < *it2) { buf = *it1; result.push_back(make_pair(buf.first, buf.second)); it1++; } else { buf = *it2; result.push_back(make_pair(buf.first, buf.second)); it2++; } } else { buf = *it1; result.push_back(make_pair(buf.first, buf.second)); it1++; } } else { buf = *it2; result.push_back(make_pair(buf.first, buf.second)); it2++; } } return result; } list<pair<int, int>> getSortedPairs(const vector<int> &p1, const vector<int> &p2, int start, int end) { list<pair<int, int>> result; if (start + 1 == end) { if (start%2 == 0) { result.push_back(make_pair(p1[start/2], p2[start/2])); } else { result.push_back(make_pair(p2[start/2], p1[start/2+1])); } return result; } else if (start >= end) { return result; } if (start % 2 == 0) { int p1_ind = 0; int p1_min = 999999; for (int i = start / 2; i <= end / 2; i++) { if (p1[i] < p1_min) { p1_min = p1[i]; p1_ind = i; } } int p2_ind = 0; int p2_min = 999999; for (int i = p1_ind; i <= end / 2; i++) { if (p2[i] < p2_min) { p2_min = p2[i]; p2_ind = i; } } result = getSortedPairs(p1, p2, start, p1_ind*2-1); result = mergeVector(result, getSortedPairs(p1, p2, p1_ind * 2 + 1, p2_ind * 2+ 1 -1)); result = mergeVector(result, getSortedPairs(p1, p2, p2_ind * 2 + 1 +1, end)); result.push_front(make_pair(p1_min, p2_min)); } else { int p2_ind = 0; int p2_min = 999999; for (int i = start/2; i < end / 2; i++) { if (p2[i] < p2_min) { p2_min = p2[i]; p2_ind = i; } } int p1_ind = 0; int p1_min = 999999; for (int i = start / 2 +1; i <= end / 2; i++) { if (p1[i] < p1_min) { p1_min = p1[i]; p1_ind = i; } } result = getSortedPairs(p1, p2, start, p2_ind * 2 +1 - 1); result = mergeVector(result, getSortedPairs(p1, p2, p2_ind * 2 + 1 + 1, p1_ind * 2 - 1)); result = mergeVector(result, getSortedPairs(p1, p2, p1_ind * 2 + 1, end)); result.push_front(make_pair(p2_min, p1_min)); } return result; } int main(void) { int N; scanf("%d", &N); vector<int> p1 = vector<int>(N/2, 0); vector<int> p2 = vector<int>(N/2, 0); getP(p1, p2, N); auto result = getSortedPairs(p1, p2, 0, N - 1); for (auto it = result.begin(); it != result.end(); it++) { printf("%d %d ", (*it).first, (*it).second); } printf("\n"); return 0; }
a.cc: In function 'std::__cxx11::list<std::pair<int, int> > getSortedPairs(const std::vector<int>&, const std::vector<int>&, int, int)': a.cc:90:60: error: cannot bind non-const lvalue reference of type 'std::__cxx11::list<std::pair<int, int> >&' to an rvalue of type 'std::__cxx11::list<std::pair<int, int> >' 90 | result = mergeVector(result, getSortedPairs(p1, p2, p1_ind * 2 + 1, p2_ind * 2+ 1 -1)); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:82: note: initializing argument 2 of 'std::__cxx11::list<std::pair<int, int> > mergeVector(std::__cxx11::list<std::pair<int, int> >&, std::__cxx11::list<std::pair<int, int> >&)' 21 | list<pair<int, int>> mergeVector(list<pair<int, int>> &v1, list<pair<int, int>> &v2) { | ~~~~~~~~~~~~~~~~~~~~~~^~ a.cc:91:60: error: cannot bind non-const lvalue reference of type 'std::__cxx11::list<std::pair<int, int> >&' to an rvalue of type 'std::__cxx11::list<std::pair<int, int> >' 91 | result = mergeVector(result, getSortedPairs(p1, p2, p2_ind * 2 + 1 +1, end)); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:82: note: initializing argument 2 of 'std::__cxx11::list<std::pair<int, int> > mergeVector(std::__cxx11::list<std::pair<int, int> >&, std::__cxx11::list<std::pair<int, int> >&)' 21 | list<pair<int, int>> mergeVector(list<pair<int, int>> &v1, list<pair<int, int>> &v2) { | ~~~~~~~~~~~~~~~~~~~~~~^~ a.cc:113:60: error: cannot bind non-const lvalue reference of type 'std::__cxx11::list<std::pair<int, int> >&' to an rvalue of type 'std::__cxx11::list<std::pair<int, int> >' 113 | result = mergeVector(result, getSortedPairs(p1, p2, p2_ind * 2 + 1 + 1, p1_ind * 2 - 1)); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:82: note: initializing argument 2 of 'std::__cxx11::list<std::pair<int, int> > mergeVector(std::__cxx11::list<std::pair<int, int> >&, std::__cxx11::list<std::pair<int, int> >&)' 21 | list<pair<int, int>> mergeVector(list<pair<int, int>> &v1, list<pair<int, int>> &v2) { | ~~~~~~~~~~~~~~~~~~~~~~^~ a.cc:114:60: error: cannot bind non-const lvalue reference of type 'std::__cxx11::list<std::pair<int, int> >&' to an rvalue of type 'std::__cxx11::list<std::pair<int, int> >' 114 | result = mergeVector(result, getSortedPairs(p1, p2, p1_ind * 2 + 1, end)); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:21:82: note: initializing argument 2 of 'std::__cxx11::list<std::pair<int, int> > mergeVector(std::__cxx11::list<std::pair<int, int> >&, std::__cxx11::list<std::pair<int, int> >&)' 21 | list<pair<int, int>> mergeVector(list<pair<int, int>> &v1, list<pair<int, int>> &v2) { | ~~~~~~~~~~~~~~~~~~~~~~^~
s917060207
p03639
C++
#include<bits/stdc++.h> using namespace std; const int maxn = 1e5+10; long long a[maxn]; map<int,int>vis; vector<int>k; int main() { ios::sync_with_stdio(false); int n; while(cin>>n) { int odd=0; int multi=0; vis.clear(); for(int i=1;i<=n;i++) { cin>>a[i]; if(a[i]%4!=0) { if(!vis[a[i]]) { odd++; vis[4/a[i]]=1; } else { odd--; vis[4/a[i]]=0; } k.push_back(a[i]); } else { multi++; } } if(k.size()==2&&multi==0) { long long t=k[0]*k[1]; if(t%4==0) { puts("Yes"); continue;2 } } if(multi>=(odd-1)) { puts("Yes"); } else { puts("No"); } } return 0; }
a.cc: In function 'int main()': a.cc:46:43: error: expected ';' before '}' token 46 | continue;2 | ^ | ; 47 | } | ~
s008855122
p03639
C++
#include<iostream> #include<vector> #define rep(i,n) for(i=0; i<n; i++) using namespace std; int main () { int n; cin>>n; vector<long long int> v; long long int num,i; rep(i,n) { cin>>num; v.push_back(num); } sort(v.begin(),v.end()); long long int j; rep(i,v.size()){ rep(j,v.size()){ if(v[i]*v[j]%4==0){ v.erase(v.begin()+i); if(v.size()==1) {break;} else {i=0;} } } } if(v.size()==1){ cout << "Yes" << endl; } else { cout <<"No" << endl;} return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(v.begin(),v.end()); | ^~~~ | short
s792117969
p03639
C++
#include <cstdio> #include <algorithm> #include <set> #include <utility> static const int MAXN = 2e5 + 4; int n; int a[MAXN], p[MAXN]; int b[MAXN], top = 0; struct rmq { static const int LOGN = 18; std::pair<int, int> f[LOGN][MAXN]; inline void build(int n, int *a) { for (int i = 0; i < n; ++i) f[0][i] = std::make_pair(a[i], i); for (int j = 1; j < LOGN; ++j) for (int i = 0; i <= n - (1 << j); ++i) f[j][i] = std::min(f[j - 1][i], f[j - 1][i + (1 << (j - 1))]); } inline std::pair<int, int> query(int l, int r) { if (l == r) return f[0][l]; int sz = 8 * sizeof(int) - __builtin_clz(r - l) - 1; return std::min(f[sz][l], f[sz][r - (1 << sz) + 1]); } } all, even, odd; struct cmp_peek { inline bool operator ()(const std::pair<int, int> a, const std::pair<int, int> b) { int ua = ((a.first & 1) ? odd : even).query(a.first, a.second).first; int ub = ((b.first & 1) ? odd : even).query(b.first, b.second).first; return ua < ub; } }; std::set<std::pair<int, int>, cmp_peek> s; void solve(int l, int r) { auto u = ((l & 1) ? odd : even).query(l, r); auto v = ((r & 1) ? odd : even).query(l, r); int pu = u.second, pv = v.second; b[top++] = u.first; b[top++] = v.first; if (l <= pu - 1) s.insert(std::make_pair(l, pu - 1)); if (pu + 1 <= pv - 1) s.insert(std::make_pair(pu + 1, pv - 1)); if (pv + 1 <= r) s.insert(std::make_pair(pv + 1, r)); } int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &a[i]), p[--a[i]] = i; all.build(n, a); for (int i = 0; i < n; ++i) b[i] = (i & 1) ? MAXN : a[i]; even.build(n, b); for (int i = 0; i < n; ++i) b[i] = (i & 1) ? a[i] : MAXN; odd.build(n, b); s.insert(std::make_pair(0, n - 1)); while (!s.empty()) { auto r = *s.begin(); s.erase(s.begin()); solve(r.first, r.second); } for (int i = 0; i < n; ++i) printf("%d%c", b[i] + 1, i == n - 1 ? '\n' : ' '); return 0; }
In file included from /usr/include/c++/14/set:62, from a.cc:3: /usr/include/c++/14/bits/stl_tree.h: In instantiation of 'static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_S_key(_Const_Link_type) [with _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; _Const_Link_type = const std::_Rb_tree_node<std::pair<int, int> >*]': /usr/include/c++/14/bits/stl_tree.h:2116:47: required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; key_type = std::pair<int, int>]' 2116 | __comp = _M_impl._M_key_compare(__k, _S_key(__x)); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_tree.h:2169:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = std::pair<int, int>; _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >]' 2169 | = _M_get_insert_unique_pos(_KeyOfValue()(__v)); | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_set.h:523:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = std::pair<int, int>; _Compare = cmp_peek; _Alloc = std::allocator<std::pair<int, int> >; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, cmp_peek, std::allocator<std::pair<int, int> > >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<std::pair<int, int> >; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::rebind<std::pair<int, int> >; typename _Alloc::value_type = std::pair<int, int>; value_type = std::pair<int, int>]' 523 | _M_t._M_insert_unique(std::move(__x)); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ a.cc:45:30: required from here 45 | if (l <= pu - 1) s.insert(std::make_pair(l, pu - 1)); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:768:15: error: static assertion failed: comparison object must be invocable as const 768 | is_invocable_v<const _Compare&, const _Key&, const _Key&>, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_tree.h:768:15: note: 'std::is_invocable_v<const cmp_peek&, const std::pair<int, int>&, const std::pair<int, int>&>' evaluates to false
s106401296
p03639
C++
#incldue<iostream> #include<cstdio> using namespace std; int main() { cout<<"Yes"; }
a.cc:1:2: error: invalid preprocessing directive #incldue; did you mean #include? 1 | #incldue<iostream> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:7:1: error: 'cout' was not declared in this scope 7 | cout<<"Yes"; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<cstdio> +++ |+#include <iostream> 3 | using namespace std;
s395341950
p03639
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; int a[4]{}; while(n--){ int x; cin >> x; a[x % 4]++; } cout << (a[1] + a[2] % 2 + a[3] <= 2 * a[0] + (2 <= m[2]) ? "Yes" : "No") << endl; }
a.cc: In function 'int main()': a.cc:13:61: error: 'm' was not declared in this scope 13 | cout << (a[1] + a[2] % 2 + a[3] <= 2 * a[0] + (2 <= m[2]) ? "Yes" : "No") << endl; | ^
s100555528
p03639
C++
#include <iostream> #include <set> #include <vector> #include <string> #include <algorithm> #include <queue> #include <set> #include <cstring> #include <map> #include <bitset> #include <random> #include <stack> #include <list> #include <unordered_set> #include <unordered_map> #include <ctime> using namespace std; #define ll long long #define ld long double #define pb push_back #define sc second #define fs first #define mp make_pair #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() template<class T> T sqr(T x) { return x*x; } ld pi = 3.1415926535897932384626433832795; ll mod = 1e9 + 7; const int N = 2e5 + 10; typedef vector<vector<ll> > mtrx; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { int n, k, ost2 = 0, ost4 = 0; cin >> n; for (int i = 0; i < n; i++) { int a; cin >> a; if (a % 4 == 0) ost4 += 1; else if (a % 2 == 0) ost2 += 1; } bool ok = 0; if (ost4) if (ost4 * 2 + 1 >= n) ok = 1; if (ost4) if (ost4 * 2 + 1 + ost2 >= n && ost2 > 1) ok = 1; if (ost2 == n) ok = 1; if (ok) cout << "Yes"; else cout << "No"; return 0; }#include <iostream> #include <set> #include <vector> #include <string> #include <algorithm> #include <queue> #include <set> #include <cstring> #include <map> #include <bitset> #include <random> #include <stack> #include <list> #include <unordered_set> #include <unordered_map> #include <ctime> using namespace std; #define ll long long #define ld long double #define pb push_back #define sc second #define fs first #define mp make_pair #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() template<class T> T sqr(T x) { return x*x; } ld pi = 3.1415926535897932384626433832795; ll mod = 1e9 + 7; const int N = 2e5 + 10; typedef vector<vector<ll> > mtrx; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } int main() { int n, k, ost2 = 0, ost4 = 0; cin >> n; for (int i = 0; i < n; i++) { int a; cin >> a; if (a % 4 == 0) ost4 += 1; else if (a % 2 == 0) ost2 += 1; } bool ok = 0; if (ost4) if (ost4 * 2 + 1 >= n) ok = 1; if (ost4) if (ost4 * 2 + ost2 >= n && ost2 > 1) ok = 1; if (ost2 == n) ok = 1; if (ok) cout << "Yes"; else cout << "No"; return 0; }
a.cc:63:2: error: stray '#' in program 63 | }#include <iostream> | ^ a.cc:63:3: error: 'include' does not name a type 63 | }#include <iostream> | ^~~~~~~ a.cc:91:21: error: redefinition of 'template<class T> T sqr(T)' 91 | template<class T> T sqr(T x) { return x*x; } | ^~~ a.cc:29:21: note: 'template<class T> T sqr(T)' previously declared here 29 | template<class T> T sqr(T x) { return x*x; } | ^~~ a.cc:92:4: error: redefinition of 'long double pi' 92 | ld pi = 3.1415926535897932384626433832795; | ^~ a.cc:30:4: note: 'long double pi' previously defined here 30 | ld pi = 3.1415926535897932384626433832795; | ^~ a.cc:93:4: error: redefinition of 'long long int mod' 93 | ll mod = 1e9 + 7; | ^~~ a.cc:31:4: note: 'long long int mod' previously defined here 31 | ll mod = 1e9 + 7; | ^~~ a.cc:94:11: error: redefinition of 'const int N' 94 | const int N = 2e5 + 10; | ^ a.cc:32:11: note: 'const int N' previously defined here 32 | const int N = 2e5 + 10; | ^ a.cc:98:4: error: redefinition of 'long long int gcd(long long int, long long int)' 98 | ll gcd(ll a, ll b) { | ^~~ a.cc:36:4: note: 'long long int gcd(long long int, long long int)' previously defined here 36 | ll gcd(ll a, ll b) { | ^~~ a.cc:104:5: error: redefinition of 'int main()' 104 | int main() { | ^~~~ a.cc:42:5: note: 'int main()' previously defined here 42 | int main() { | ^~~~
s053387500
p03639
C++
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; public class Program { #region Standard I/O readonly TextReader input; readonly TextWriter output; X[] ReadLine<X>(Func<string, X> func) { return input.ReadLine().Split(' ').Select(func).ToArray(); } void WriteLineOne(object obj) { output.WriteLine("{0}", obj); } void WriteLineMany(params object[] objects) { output.WriteLine(string.Join(" ", objects.Select(obj => obj.ToString()))); } #endregion int n; int count1; int count2; int count4; void Read() { n = ReadLine(int.Parse)[0]; foreach (var x in ReadLine(long.Parse)) { if (x % 4 == 0) { count4++; } else if (x % 2 == 0) { count2++; } else { count1++; } } } int PopLowest() { if (count1 > 0) { count1--; return 1; } else if (count2 > 0) { count2--; return 2; } else if (count4 > 0) { count4--; return 4; } throw new InvalidOperationException(); } bool TryPop4() { if (count4 > 0) { count4--; return true; } return false; } bool TryPop2Or4(out int value) { if (count4 > 0) { count4--; value = 4; return true; } else if (count2 > 0) { count2--; value = 2; return true; } value = default(int); return false; } bool Verify(int[] xs) { for (var i = 0; i + 1 < xs.Length; i++) { if (xs[i] * xs[i + 1] % 4 != 0) return false; } return true; } bool Solve() { var result = new int[n]; result[0] = PopLowest(); result[n - 1] = PopLowest(); for (var r = 0; r < n - 2; r++) { if (r % 2 == 0) { var i = 1 + r / 2; switch (result[i - 1]) { case 1: { if (!TryPop4()) return false; result[i] = 4; break; } case 2: { if (!TryPop2Or4(out result[i])) return false; break; } case 4: { result[i] = PopLowest(); break; } default: throw new InvalidOperationException(); } } else { var i = n - 2 - r / 2; switch (result[i + 1]) { case 1: { if (!TryPop4()) return false; result[i] = 4; break; } case 2: { if (!TryPop2Or4(out result[i])) return false; break; } case 4: { result[i] = PopLowest(); break; } default: throw new InvalidOperationException(); } } } return Verify(result); } public void Run() { Read(); WriteLineOne(Solve() ? "Yes" : "No"); } public Program(TextReader input, TextWriter output) { this.input = input; this.output = output; } public static void Main(string[] args) { new Program(Console.In, Console.Out).Run(); } }
a.cc:10:6: error: invalid preprocessing directive #region 10 | #region Standard I/O | ^~~~~~ a.cc:28:6: error: invalid preprocessing directive #endregion 28 | #endregion | ^~~~~~~~~ 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.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.IO; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Linq; | ^~~~~~ a.cc:5:7: error: expected nested-name-specifier before 'System' 5 | using System.Text; | ^~~~~~ a.cc:6:7: error: expected nested-name-specifier before 'System' 6 | using System.Threading.Tasks; | ^~~~~~ a.cc:8:1: error: expected unqualified-id before 'public' 8 | public class Program | ^~~~~~
s462586123
p03639
C++
include <iostream> #include <algorithm> #include <string> #include <vector> #include <functional> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define VI vector<int> #define debug(x) cout<<#x<<": "<<x<<endl #define DEBUG(x) cout<<#x<<": "<<x<<endl int N; int n4 = 0; int n2 = 0; int main() { cin >> N; bool flg = false; REP(i,N){ int a; cin >> a; if(a%4==0) n4++; else if(a%2==0) n2++; } if(n4*3 >= N) flg = true; else if(n4 != 0 && (n4*3 + n2 - 1) >= N) flg = true; else if(n4 == 0 && n2 == N) flg = true; else flg = false; if(flg) cout << "Yes" << endl; else cout << "No" << endl; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
s840745718
p03639
C++
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key #define INF 1e9 typedef long long ll; typedef pair<ll,ll> ii; typedef vector<int> vi; typedef vector < pair<int, int> > vii; typedef long double ld; typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds; typedef set<int>::iterator sit; typedef map<int,int>::iterator mit; typedef vector<int>::iterator vit; ll cnt[3], n, x; int main() { cin >> n; for(int i = 0; i < n; i++){ cin >> x; if(x%4==0){ cnt[2]++; } else if(x%2==0){ cnt[1]++; } else{ cnt[0]++; } } if(cnt[2]){ if(cnt[1]>1||cnt[1]==0){ if(cnt[0]<=cnt[2]){ cout<<"Yes\n"; } else{ cout << "No\n"; } } else{ if(cnt[0]+cnt[1]<=cnt[2]+1){ cout << "Yes\n"; } else{ cout << "No\n"; } } } else{ if(cnt[0]){ cout << "No\n"; } else{ if(cnt[1]>1||cnt[1]==0){ cout << "Yes\n"; } else{ cout << "No\n"; } } return 0; }
a.cc: In function 'int main()': a.cc:75:2: error: expected '}' at end of input 75 | } | ^ a.cc:29:1: note: to match this '{' 29 | { | ^
s627985662
p03639
C++
/* coder:xxjAc name: time:2017/8/5 */ #include <sstream> #include <queue> #include <stack> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cctype> #include <complex> #include <cmath> #include <iostream> #include <iomanip> #include <string> #include <utility> #include <vector> #include <algorithm> #include <bitset> #include <list> #include <string.h> #include <assert.h> #include <time.h> #include <fstream> #include <numeric> #include <cstring> using namespace std; int n; int have=0; int c4=0,c1=0; int main(){ scanf("%d",&n); int x; for (int i=0;i<n;i++){ scanf("%d",&x); if (x%4==0){ c4++; } else if(x%2==0){ have=1; } else{ c1++; } } if (c4+1>=have+c1){ printf("Yes\n"); } else{ printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:46:29: error: expected ';' before '\U0000ff1b' 46 | c1++; | ^~ | ;
s389353031
p03639
C++
#include <bits/stdc++.h> #include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #include<cstring> #include<string> #include <math.h> #include<algorithm> // #include <boost/multiprecision/cpp_int.hpp> #include<functional> #define int long long #define inf 1000000007 #define pa pair<int,int> #define ll long long #define pal pair<double,int> #define ppa pair<string,pa> #define ssa pair<string,int> #define mp make_pair #define pb push_back #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; //priority_queue<int, vector<int>, greater<int> > que; class Point{ public: double x,y; Point(double x=0,double y=0):x(x),y(y) {} Point operator + (Point p) {return Point(x+p.x,y+p.y);} Point operator - (Point p) {return Point(x-p.x,y-p.y);} Point operator * (double a) {return Point(x*a,y*a);} Point operator / (double a) {return Point(x/a,y/a);} double absv() {return sqrt(norm());} double norm() {return x*x+y*y;} bool operator < (const Point &p) const{ return x != p.x ? x<p.x: y<p.y; } bool operator == (const Point &p) const{ return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS; } }; typedef Point Vector; struct Segment{ Point p1,p2; }; double hen(Vector a){ if(fabs(a.x)<EPS && a.y>0) return acos(0); else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0); else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0); else if(fabs(a.y)<EPS && a.x>0) return 0.0; else if(a.y>0) return acos(a.x/a.absv()); else return 2*acos(0)+acos(-a.x/a.absv()); } string itos( int i ) { ostringstream s ; s << i ; return s.str() ; } int gcd(int v,int b){ if(v>b) return gcd(b,v); if(v==b) return b; if(b%v==0) return v; return gcd(v,b%v); } double dot(Vector a,Vector b){ return a.x*b.x+a.y*b.y; } double cross(Vector a,Vector b){ return a.x*b.y-a.y*b.x; } double distans(double x1,double y1,double x2,double y2){ double rr=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); return sqrt(rr); } //----------------kokomade tenpure------------ int a[50]; int n; bool bi(int d){ int z[50]; for(int i=0;i<n;i++) z[i]=a[i]+d; bool b=false; int y=0; for(int i=0;i<n;i++){ int r=a[i]/n; y +=r; } cout<<d<<endl; if(y<=d) return true; else return false; } //int a[100020]; signed main(){ int n; cin>>n; int z=0,z2=0,z3=0; for(int i=0;i<n;i++){ int k; cin>>k; if(k%4==0) z++; else if(k%2==0) z2++; else z3++; } bool b=false; if(z>=z3)b=true; if(z3==z+1){ if(z3==1) b=false; else if(z2==0) b=true; } if(b) cout<<"Yes"<<endl; else cout<<"No"<<endl; // cout<<ans<<endl; return 0; } #include <bits/stdc++.h> #include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #include<cstring> #include<string> #include <math.h> #include<algorithm> // #include <boost/multiprecision/cpp_int.hpp> #include<functional> #define int long long #define inf 1000000007 #define pa pair<int,int> #define ll long long #define pal pair<double,int> #define ppa pair<string,pa> #define ssa pair<string,int> #define mp make_pair #define pb push_back #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; //priority_queue<int, vector<int>, greater<int> > que; class Point{ public: double x,y; Point(double x=0,double y=0):x(x),y(y) {} Point operator + (Point p) {return Point(x+p.x,y+p.y);} Point operator - (Point p) {return Point(x-p.x,y-p.y);} Point operator * (double a) {return Point(x*a,y*a);} Point operator / (double a) {return Point(x/a,y/a);} double absv() {return sqrt(norm());} double norm() {return x*x+y*y;} bool operator < (const Point &p) const{ return x != p.x ? x<p.x: y<p.y; } bool operator == (const Point &p) const{ return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS; } }; typedef Point Vector; struct Segment{ Point p1,p2; }; double hen(Vector a){ if(fabs(a.x)<EPS && a.y>0) return acos(0); else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0); else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0); else if(fabs(a.y)<EPS && a.x>0) return 0.0; else if(a.y>0) return acos(a.x/a.absv()); else return 2*acos(0)+acos(-a.x/a.absv()); } string itos( int i ) { ostringstream s ; s << i ; return s.str() ; } int gcd(int v,int b){ if(v>b) return gcd(b,v); if(v==b) return b; if(b%v==0) return v; return gcd(v,b%v); } double dot(Vector a,Vector b){ return a.x*b.x+a.y*b.y; } double cross(Vector a,Vector b){ return a.x*b.y-a.y*b.x; } double distans(double x1,double y1,double x2,double y2){ double rr=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); return sqrt(rr); } //----------------kokomade tenpure------------ int a[50]; int n; bool bi(int d){ int z[50]; for(int i=0;i<n;i++) z[i]=a[i]+d; bool b=false; int y=0; for(int i=0;i<n;i++){ int r=a[i]/n; y +=r; } cout<<d<<endl; if(y<=d) return true; else return false; } //int a[100020]; signed main(){ int n; cin>>n; int z=0,z2=0,z3=0; for(int i=0;i<n;i++){ int k; cin>>k; if(k%4==0) z++; else if(k%2==0) z2++; else z3++; } bool b=false; if(z>=z3)b=true; if(z3==z+1){ if(z3==1) b=false; else if(z2==0) b=true; } if(b) cout<<"Yes"<<endl; else cout<<"No"<<endl; // cout<<ans<<endl; return 0; }
a.cc:135:30: error: stray '#' in program 135 | } #include <bits/stdc++.h> | ^ a.cc:135:31: error: 'include' does not name a type 135 | } #include <bits/stdc++.h> | ^~~~~~~ a.cc:161:35: error: redefinition of 'class Point' 161 | class Point{ | ^~~~~ a.cc:27:35: note: previous definition of 'class Point' 27 | class Point{ | ^~~~~ a.cc:180:36: error: redefinition of 'struct Segment' 180 | struct Segment{ | ^~~~~~~ a.cc:46:36: note: previous definition of 'struct Segment' 46 | struct Segment{ | ^~~~~~~ a.cc:184:32: error: redefinition of 'double hen(Vector)' 184 | double hen(Vector a){ | ^~~ a.cc:50:32: note: 'double hen(Vector)' previously defined here 50 | double hen(Vector a){ | ^~~ a.cc:194:24: error: redefinition of 'std::string itos(long long int)' 194 | string itos( int i ) { | ^~~~ a.cc:60:24: note: 'std::string itos(long long int)' previously defined here 60 | string itos( int i ) { | ^~~~ a.cc:200:21: error: redefinition of 'long long int gcd(long long int, long long int)' 200 | int gcd(int v,int b){ | ^~~ a.cc:66:21: note: 'long long int gcd(long long int, long long int)' previously defined here 66 | int gcd(int v,int b){ | ^~~ a.cc:206:36: error: redefinition of 'double dot(Vector, Vector)' 206 | double dot(Vector a,Vector b){ | ^~~ a.cc:72:36: note: 'double dot(Vector, Vector)' previously defined here 72 | double dot(Vector a,Vector b){ | ^~~ a.cc:209:36: error: redefinition of 'double cross(Vector, Vector)' 209 | double cross(Vector a,Vector b){ | ^~~~~ a.cc:75:36: note: 'double cross(Vector, Vector)' previously defined here 75 | double cross(Vector a,Vector b){ | ^~~~~ a.cc:213:24: error: redefinition of 'double distans(double, double, double, double)' 213 | double distans(double x1,double y1,double x2,double y2){ | ^~~~~~~ a.cc:79:24: note: 'double distans(double, double, double, double)' previously defined here 79 | double distans(double x1,double y1,double x2,double y2){ | ^~~~~~~ a.cc:222:5: error: redefinition of 'long long int a [50]' 222 | int a[50]; | ^ a.cc:88:5: note: 'long long int a [50]' previously declared here 88 | int a[50]; | ^ a.cc:223:5: error: redefinition of 'long long int n' 223 | int n; | ^ a.cc:89:5: note: 'long long int n' previously declared here 89 | int n; | ^ a.cc:226:6: error: redefinition of 'bool bi(long long int)' 226 | bool bi(int d){ | ^~ a.cc:92:6: note: 'bool bi(long long int)' previously defined here 92 | bool bi(int d){ | ^~ a.cc:242:8: error: redefinition of 'int main()' 242 | signed main(){ | ^~~~ a.cc:108:8: note: 'int main()' previously defined here 108 | signed main(){ | ^~~~
s772349821
p03639
C++
#include <assert.h> #include <ctype.h> #include <errno.h> #include <float.h> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <wchar.h> #include <wctype.h> #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <map> #include <ios> #include <iosfwd> #include <istream> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <utility> #include <vector> #include <cwchar> #include <cwctype> #include <complex.h> #include <fenv.h> #include <inttypes.h> #include <stdbool.h> #include <stdint.h> #include <tgmath.h> #include <conio.h> #include <numeric> #include <list> #include <windows.h> #include <cfloat> #include <climits> #include <unordered_map> #include <unordered_set> using namespace std; int n,a[100010],sum; int main() { cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; if(a[i]%4==0) sum++; } if(sum>=n/3+n%3==0?0:1) cout<<"Yes"; else cout<<"No"; return 0; }
a.cc:53:10: fatal error: conio.h: No such file or directory 53 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s937724958
p03640
C++
#include <bits/stdc++.h> using namespace std; #define PI 3.141592653589793 #define MOD 1000000007 #define rep(i, n) for (ll i = 0; i < n; i++) #define all(v) v.begin(), v.end() typedef long long ll; typedef long double ld; int main() { ll H, W, N; cin >> H >> W >> N; vector<ll> a(N, 0); rep(i, N) cin >> a[i]; ll ans[H][W] = {0}; ll id=0; rep(i,h){ if(i % 2 == 0){ rep(j,w){ ans[i][j] = id + 1; a[id]--; if(a[id] == 0) id++; } } else{ for(ll j = w - 1;j >= 0; j--){ ans[i][j] = id + 1; a[id]--; if(a[id] == 0) id++; } } } rep(i,h){ rep(j,w){ cout << ans[i][j] << " "; } cout << endl; } }
a.cc: In function 'int main()': a.cc:19:11: error: 'h' was not declared in this scope 19 | rep(i,h){ | ^ a.cc:5:38: note: in definition of macro 'rep' 5 | #define rep(i, n) for (ll i = 0; i < n; i++) | ^ a.cc:21:19: error: 'w' was not declared in this scope 21 | rep(j,w){ | ^ a.cc:5:38: note: in definition of macro 'rep' 5 | #define rep(i, n) for (ll i = 0; i < n; i++) | ^ a.cc:28:24: error: 'w' was not declared in this scope 28 | for(ll j = w - 1;j >= 0; j--){ | ^ a.cc:36:11: error: 'h' was not declared in this scope 36 | rep(i,h){ | ^ a.cc:5:38: note: in definition of macro 'rep' 5 | #define rep(i, n) for (ll i = 0; i < n; i++) | ^ a.cc:37:15: error: 'w' was not declared in this scope 37 | rep(j,w){ | ^ a.cc:5:38: note: in definition of macro 'rep' 5 | #define rep(i, n) for (ll i = 0; i < n; i++) | ^
s841120618
p03640
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod=1000000007; const int MAX_N = 1000; // n の最大値 double tenchoku(double x1, double y1 , double x2 , double y2, double x, double y) { double a = (y1-y2)/(x1-x2); double b = -1; double c = y1-a*x1; double k = abs(a*x+b*y+c)/sqrt(a*a+b*b); return k;} // nCk を取得 double nCk(int n, int k) { double res=1.0; for(int i=0; i<n; i++){ res*=0.5;} for(int i=0; i<k; i++){ res*=(double)(n-i); res/=(double)(k-i);} return res;} int main(){ cout << fixed << setprecision(10); ll n; cin>>n; ll counter=0; ll f=0; ll h,w; cin>>h>>w; ll a[n]={}; ll ca=0; ll d[h][w]={{}}; for(ll i=0; i<n; i++){ cin>>a[i];} for(ll i=0; i<h; i++){ for(ll m=0; i<w; m++){ if(a[ca]+m<=w){ for(ll k=0; k<a[ca]+m; k++){ d[i][k]=ca;}
a.cc: In function 'int main()': a.cc:39:13: error: expected '}' at end of input 39 | d[i][k]=ca;} | ^ a.cc:37:15: note: to match this '{' 37 | if(a[ca]+m<=w){ | ^ a.cc:39:13: error: expected '}' at end of input 39 | d[i][k]=ca;} | ^ a.cc:36:22: note: to match this '{' 36 | for(ll m=0; i<w; m++){ | ^ a.cc:39:13: error: expected '}' at end of input 39 | d[i][k]=ca;} | ^ a.cc:35:22: note: to match this '{' 35 | for(ll i=0; i<h; i++){ | ^ a.cc:39:13: error: expected '}' at end of input 39 | d[i][k]=ca;} | ^ a.cc:22:11: note: to match this '{' 22 | int main(){ | ^
s274507410
p03640
C++
#include<bits/stdc++.h> using namespace std; int main(){ int h,w; int n; vector<int> a; cin >> h >> w; cin >> n; for(int i=0; i<n; i++){ int _a; cin >> _a; a.push_back(_a); } int c[h][w]; fill(c[0],c[h],0); int hi=0;wi=0,d=0; int dr[4][2] = { {0,1}, {1,0}, {0,-1}, {-1,0} }; int ai=0; for(int cnt=0; cnt<h*w; cnt++){ if(a.at(ai)==0)ai++; c[hi][wi] = ai+1; a.at(ai)--; if(hi+dr[d][0]<0 || hi+dr[d][0]>=h || wi+dr[d][1]<0 || wi+dr[d][1]>=w){ d++; d%=4; } else if(c[hi+dr[d][0]][wi+dr[d][1]]>0){ d++; d%=4; } hi+=dr[d][0]; wi+=dr[d][1]; } // output for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ cout << c[i][j]; if (j!=w-1) cout << ' '; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:14: error: 'wi' was not declared in this scope; did you mean 'hi'? 17 | int hi=0;wi=0,d=0; | ^~ | hi a.cc:17:19: error: 'd' was not declared in this scope 17 | int hi=0;wi=0,d=0; | ^
s337718365
p03640
C
H,W=map(int,input().split()) N=int(input()) la=list(map(int,input().split())) lans=[[0 for _ in range(W)] for _ in range(H)] count=0 tmpi=0 for i in range(H): if i%2==0: for j in range(W): if count==0: tmpi+=1 count=la[tmpi-1] lans[i][j]=tmpi count-=1 else: for j in range(W-1,-1,-1): if count==0: tmpi+=1 count=la[tmpi-1] lans[i][j]=tmpi count-=1 for i in range(H): for j in range(W-1): print(lans[i][j],end=" ") print(lans[i][W-1])
main.c:1:1: warning: data definition has no type or storage class 1 | H,W=map(int,input().split()) | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'H' [-Wimplicit-int] main.c:1:3: error: type defaults to 'int' in declaration of 'W' [-Wimplicit-int] 1 | H,W=map(int,input().split()) | ^ main.c:1:5: error: implicit declaration of function 'map' [-Wimplicit-function-declaration] 1 | H,W=map(int,input().split()) | ^~~ main.c:1:9: error: expected expression before 'int' 1 | H,W=map(int,input().split()) | ^~~ main.c:2:1: error: expected ',' or ';' before 'N' 2 | N=int(input()) | ^
s989795875
p03640
C++
/* このコード、と~おれ! Be accepted! ∧_∧  (。・ω・。)つ━☆・*。 ⊂   ノ    ・゜+.  しーJ   °。+ *´¨)          .· ´¸.·*´¨) ¸.·*¨)           (¸.·´ (¸.·'* ☆ */ #include <cstdio> #include <algorithm> #include <string> #include <cmath> #include <cstring> #include <vector> #include <numeric> #include <iostream> #include <random> #include <map> #include <unordered_map> #include <queue> #include <regex> #include <functional> #include <complex> #include <list> #include <cassert> #include <iomanip> #include <set> /*多倍長整数/cpp_intで宣言 #include <boost/multiprecision/cpp_int.hpp> using namespace boost::multiprecision; */ //#pragma gcc target ("avx2") //#pragma gcc optimization ("o3") //#pragma gcc optimization ("unroll-loops") #define rep(i, n) for(int i = 0; i < (n); ++i) #define rep1(i, n) for(int i = 1; i <= (n); ++i) #define rep2(i, n) for(int i = 2; i < (n); ++i) #define repr(i, n) for(int i = n; i >= 0; --i) #define reprm(i, n) for(int i = n - 1; i >= 0; --i) #define printynl(a) printf(a ? "yes\n" : "no\n") #define printyn(a) printf(a ? "Yes\n" : "No\n") #define printYN(a) printf(a ? "YES\n" : "NO\n") #define printim(a) printf(a ? "possible\n" : "imposible\n") #define printdb(a) printf("%.50lf\n", a) //少数出力 #define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ) #define prints(s) printf("%s\n", s.c_str()) //string出力 #define all(x) (x).begin(), (x).end() #define allsum(a, b, c) ((a + b) * c / 2.0) //等差数列の和、初項,末項,項数 #define pb push_back #define priq priority_queue #define rpriq priq<int, vector<int>, greater<int>> #define deg_to_rad(deg) (((deg)/360.0)*2.0*PI) #define rad_to_deg(rad) (((rad)/2.0/PI)*360.0) #define Please return #define AC 0 #define addf(T) [](T a, T b){return (a + b);} #define minf(T) [](T a, T b){return min(a, b);} #define maxf(T) [](T a, T b){return max(a, b);} #define nopf(T) [](T a){return a;} #define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */ using ll = long long; constexpr int INF = 1073741823; constexpr int MINF = -1073741823; constexpr ll LINF = ll(4661686018427387903); constexpr ll MOD = 1000000007; const long double PI = acos(-1.0L); using namespace std; void scans(string& str) { char c; str = ""; scanf("%c", &c); if (c == '\n')scanf("%c", &c); while (c != '\n' && c != -1 && c != ' ') { str += c; scanf("%c", &c); } } void scanc(char& str) { char c; scanf("%c", &c); if (c == -1)return; while (c == '\n') { scanf("%c", &c); } str = c; } double acot(double x) { return PI / 2 - atan(x); } ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); } ll lcm(ll number1, ll number2) { return number1 / gcd(number1, number2) * number2; } ll LSB(ll n) { return (n & (-n)); } /*-----------------------------------------ここからコード-----------------------------------------*/ int main() { int h, w, n; scanf("%d%d%d", &h, &w, &n); vector<int> a(n); rep(i, n) { scanf("%d", &a[i]); } vector<int> ans(h * w); int idx = 0; rep(i, n) { fill(ans.begin() + idx, ans.begin() + idx + a[i], i + 1); idx += a[i]; } rep(i, h) { rep(j, w) { if (h & 1) printf("%d\n", ans[i * h + (w - j - 1)]); else printf("%d\n", ans[i * h + j]); } Please AC; }
a.cc: In function 'int main()': a.cc:136:2: error: expected '}' at end of input 136 | } | ^ a.cc:115:12: note: to match this '{' 115 | int main() { | ^
s777781365
p03640
C++
#include<bits/stdc++.h> #include<unordered_set> #include<unordered_map> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (int)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; using vc = vector<char>; using vvc = vector<vc>; ll dx[4]={0,1,0,-1}; ll dy[4]={1,0,-1,0}; int main(){ ll h,w; cin>>h>>w; ll n; cin>>n; vll a(n); rep(i,n) cin>a[i]; vvll ans(h,vll(w)); ll cu=0; ll i=0; ll j=0; while(1){ if(a[cu]==0) cu++; if((i%2==0&&j==w-1)||(i%2==1&&j==0)){ i++; if(i==h) break; a[cu]--; ans[i][j]=cu; } else if(i%2==0){ ans[i][j]=cu; j++; a[cu]--; } else if(i%2==1){ ans[i][j]=cu; j--; a[cu]--; } } rep(i,h){ rep(j,w){ cout<<ans[i][j]<<" "; } cout<<endl; } }
a.cc: In function 'int main()': a.cc:48:15: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 48 | rep(i,n) cin>a[i]; a.cc:48:15: note: candidate: 'operator>(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int})' (built-in) a.cc:48:15: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:48:19: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:48:19: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 48 | rep(i,n) cin>a[i]; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 48 | rep(i,n) cin>a[i]; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 48 | rep(i,n) cin>a[i]; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:48:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:48:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 48 | rep(i,n) cin>a[i]; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | oper
s238715801
p03640
C++
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define all(v) (v).begin(),(v).end() #define chmin(x,y) x = min(x,y) #define chmax(x,y) x = max(x,y) typedef pair<int, int> P; typedef long long ll; const int INF = 1001001001; const ll LINF = 1001002003004005006ll; const ll MOD = 1e9+7; ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a, ll b) { return a/gcd(a,b)*b;} int main() { int h, w; cin >> h >> w; int n; cin >> n; vector<int> a(n); rep(i,n) cin >> a[i]; vector<vector<int>> ans(h, vector<int>(w)); int num = 0; rep(x, n) rep(y, a[x]) { int i = num/w; int j = num%w; if (i%2) j = w-1-j; ans[i][j] = x+1; num++; } rep(i,h) cout << ans[i] << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:23: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}) 31 | rep(i,h) cout << ans[i] << endl; In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_
s287009042
p03640
C++
#include<iostream> #include<vector> #include <algorithm> #include <bits/stdc++.h> using namespace std; int main(){ int H , W , N, a[10010]; cin >> H >> W; cin >> N; for (int i = 0; i < N; ++i) cin >> a[i]; vector<vector<int> > res(H, vector<int>(W, 0)); int x = 0, y = 0; for (int i = 0; i < N; ++i) { for (int j = 0; j < a[i]; ++j) { res[x][y] = i+1; ++y; if (y == W) { ++x, y = 0; } } } for (int i = 0; i < H; ++i) { if (i & 1) reverse(res[i].begin(), res[i].end()); } for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { cout << res[i][j]; if (j != W-1) cout << " "; } cout << endl; } } }
a.cc:44:1: error: expected declaration before '}' token 44 | } | ^
s791337017
p03640
C++
#include<iostream> #include<vector> using namespace std; int main(){ int H , W , N, a[10010]; cin >> H >> W; cin >> N; for (int i = 0; i < N; ++i) cin >> a[i]; vector<vector<int> > res(H, vector<int>(W, 0)); int x = 0, y = 0; for (int i = 0; i < N; ++i) { for (int j = 0; j < a[i]; ++j) { res[x][y] = i+1; ++y; if (y == W) { ++x, y = 0; } } } for (int i = 0; i < H; ++i) { if (i & 1) reverse(res[i].begin(), res[i].end()); } for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { cout << res[i][j]; if (j != W-1) cout << " "; } cout << endl; } } }
a.cc: In function 'int main()': a.cc:28:17: error: 'reverse' was not declared in this scope 28 | reverse(res[i].begin(), res[i].end()); | ^~~~~~~ a.cc: At global scope: a.cc:39:1: error: expected declaration before '}' token 39 | } | ^
s960303537
p03640
C++
import sys input = sys.stdin.readline from operator import itemgetter sys.setrecursionlimit(10000000) INF = 10**30 def main(): h, w = list(map(int, input().strip().split())) n = int(input().strip()) a = list(map(int, input().strip().split())) c = [[0] * w for _ in range(h)] k = 1 l = 0 for i in range(h): for j in range(w): if i % 2 == 0: c[i][j] = k else: c[i][w-1-j] = k a[l] -= 1 if a[l] == 0: k += 1 l += 1 for i in range(h): print(' '.join(map(str, c[i]))) if __name__ == '__main__': main()
a.cc:27:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 27 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s315268764
p03640
C++
H,W=map(int,input().split()) N=int(input()) L=list(map(int,input().split())) print(L) col=0 M=[[0]*W for _ in range(H)] for i in range(H): if i%2==0: for j in range(W): # print(i) # print(j) if L[col]>0: M[i][j]=col+1 L[col]-=1 if L[col]==0: col+=1 else: for j in range(W-1,-1,-1): # print(i) # print(j) if L[col]>0: M[i][j]=col+1 L[col]-=1 if L[col]==0: col+=1 for q in range(H): for w in range(W): print(M[q][w],end=" ") print()
a.cc:13:11: error: invalid preprocessing directive #print 13 | # print(i) | ^~~~~ a.cc:14:11: error: invalid preprocessing directive #print 14 | # print(j) | ^~~~~ a.cc:22:11: error: invalid preprocessing directive #print 22 | # print(i) | ^~~~~ a.cc:23:11: error: invalid preprocessing directive #print 23 | # print(j) | ^~~~~ a.cc:1:1: error: 'H' does not name a type 1 | H,W=map(int,input().split()) | ^
s769706572
p03640
C++
#include <bits/stdc++.h> #define REP(i,n) for (int i = 0; i < (n); i++) #define RREP(i, s, n) for (int i = s; i < (n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.rbegin(), a.rend() #define maxs(x,y) x = max(x, y) #define mins(x,y) x = min(x, y) using namespace std; using ll = long long; typedef pair<int, int> pint; typedef pair<ll, ll> pll; const ll MOD = 1000000007; const ll INF = MOD * MOD; const int inf = (1<<29); int main() { int H, W, N; cin >> H >> W >> N; vector<int> a(N); REP(i, N) cin >> a[i]; vector<vector<int>> ans(H, vector<int> (W)); int x = 0; REP(i, N) { REP(j, a[i]) { int ni = x/W, nj = x%W; if (ni & 1) nj = W-nj-1; ans[ni][nj] = i + 1; x++; } } REP(i, H) { cout << ans[i] << endl; } //cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:36:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'}) 36 | cout << ans[i] << endl; In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = st
s729437989
p03640
C++
#include <iostream> #include <cassert> #include <iomanip> #include <utility> #include <cmath> #include <numeric> #include <vector> #include <set> #include <map> #include <algorithm> #include <queue> #include <string> using namespace std; typedef long long ll; typedef pair<int, int> p_i; #define rep(i, n) for (int i = 0; i < n; i++) #define repext(i, a, b) for (int i = a; i < b; i++) #define reprev(i, n) for (int i = n - 1; i >= 0; i--) #define repextrev(i, a, b) for (int i = b - 1; i >= a; i--) #define repv(v, values) for (auto v : values) #define vec_all(vec) vec.begin(), vec.end() #define sum(vec) accumulate(vec_all(vec), 0LL) #define srt(vec) sort(vec_all(vec)) #define rev(vec) reverse(vec_all(vec)) #define revsrt(vec) \ srt(vec); \ rev(vec) // vectorデバッグ template <typename T> void dump_vec(vector<T> vec) { rep(i, vec.size()) { cout << i << ": " << vec[i] << endl; } } template <typename T, typename S> void dump_dic(map<T, S> dic) { for (auto v : dic) { cout << v.first << ": " << v.second << endl; } } // --- notice --- // intの和はllにしろ int main() { int h, w; cin >> h >> w; int n; cin >> n; vector<int> a(n); cin >> a[0]; int tmp; repext(i, 1, n) { cin >> tmp; a[i] += a[i - 1] + tmp; } vector<p_i> pos; rep(i, h) { if (i % 2 == 0) { rep(j, w) { pos.push_back(p_i(i, j)); } } else { reprev(j, w) { pos.push_back(p_i(i, j)); } } } vector<vector<int>> map(h, vector<int>(w, 0)); int sum_index = 0; int current_sum = a[sum_index]; rep(i, h * w) { if (i == current_sum) { sum_index++; current_sum = a[sum_index]; } int y = pos[i].first; int x = pos[i].`second; map[y][x] = sum_index + 1; } rep(i, h) { rep(j, w) { cout << map[i][j] << " "; } cout << endl; } return 0; }
a.cc:93:24: error: stray '`' in program 93 | int x = pos[i].`second; | ^
s546505223
p03640
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int w = sc.nextInt(); int n = sc.nextInt(); int[] a = new int[n]; for(int i = 0;i < n;i++)a[i]=sc.nextInt(); int[][] ans = new int[h][w]; int i = 0; int j = 0; for(int c= 0;c < n;c++){ while(a[c]>0){ ans[i][j]=c+1; a[c]--; j+=(i%2==0)?1:-1; if(j<0){ i++; j=0; }else if(j>=w){ i++; j=w-1; } } } for(int i = 0;i < h;i++){ System.out.print(ans[i][0]); for(int j = 1;j < w;j++){ System.out.print(" "+ans[i][j]); } System.out.println(""); } } }
Main.java:27: error: variable i is already defined in method main(String[]) for(int i = 0;i < h;i++){ ^ Main.java:29: error: variable j is already defined in method main(String[]) for(int j = 1;j < w;j++){ ^ 2 errors
s947172392
p03640
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){//桁数 double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){//最小公倍数 int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){//最大公約数 int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } signed main(){ int a,b,c; cin>>a>>b>>c; vector<int> d(c); fo(i,c) cin>>d[i]; vector<int> e; for(int i=0;i<c,i++){ for(int j=0;j<d[i];j++){ d.push_back(i+1); } } vector<int> f(b); fo(i,a){ fo(j,b){ if(i%2==0){ cout<<d[i*b+j]; if(j==b-1) cout<<endl; else cout<<" "; } else{ fo(k,b) f[k]==d[i*b+j]; rev(d); cout<<f[j]; if(j==b-1) cout<<endl; else cout<<" "; } } } }
a.cc: In function 'int main()': a.cc:64:22: error: expected ';' before ')' token 64 | for(int i=0;i<c,i++){ | ^ | ; a.cc:82:9: error: 'rev' was not declared in this scope 82 | rev(d); | ^~~
s701199247
p03640
C++
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using System.Runtime.CompilerServices; using static MyUtil; class MyUtil { public static int[] ReadIntArray() { return ReadLine().Split().Select(x => int.Parse(x)).ToArray(); } } class Program { public static void Main() { var tmp = ReadIntArray(); int h = tmp[0], w = tmp[1]; int n = int.Parse(ReadLine()); int[] d = new int[h*w]; int idx = 0; int[] a = ReadIntArray(); for (int i = 0; i < n; i++) { for (int j = 0; j < a[i]; j++) { d[idx++] = i+1; } } for (int i = 0; i < h; i++) { string s = ""; int baseIdx = i * w; if ((i&1) == 0) { for (int j = 0; j < w; j++) { s += d[baseIdx + j].ToString(); } } else { for (int j = w-1; j >= 0; j--) { s += d[baseIdx + j].ToString(); } } WriteLine(s); } } }
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.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'static' 4 | using static System.Console; | ^~~~~~ a.cc:5:7: error: expected nested-name-specifier before 'System' 5 | using System.Runtime.CompilerServices; | ^~~~~~ a.cc:6:7: error: expected nested-name-specifier before 'static' 6 | using static MyUtil; | ^~~~~~ a.cc:10:11: error: expected ':' before 'static' 10 | public static int[] ReadIntArray() | ^~~~~~~ | : a.cc:10:22: error: expected unqualified-id before '[' token 10 | public static int[] ReadIntArray() | ^ a.cc:14:2: error: expected ';' after class definition 14 | } | ^ | ; a.cc:18:11: error: expected ':' before 'static' 18 | public static void Main() | ^~~~~~~ | : a.cc:59:2: error: expected ';' after class definition 59 | } | ^ | ; a.cc: In static member function 'static void Program::Main()': a.cc:20:9: error: 'var' was not declared in this scope 20 | var tmp = ReadIntArray(); | ^~~ a.cc:21:17: error: 'tmp' was not declared in this scope 21 | int h = tmp[0], w = tmp[1]; | ^~~ a.cc:22:17: error: expected primary-expression before 'int' 22 | int n = int.Parse(ReadLine()); | ^~~ a.cc:24:12: error: structured binding declaration cannot have type 'int' 24 | int[] d = new int[h*w]; | ^~ 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 'd' 24 | int[] d = new int[h*w]; | ^ a.cc:27:12: error: structured binding declaration cannot have type 'int' 27 | int[] a = ReadIntArray(); | ^~ a.cc:27:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:27:12: error: empty structured binding declaration a.cc:27:15: error: expected initializer before 'a' 27 | int[] a = ReadIntArray(); | ^ a.cc:30:33: error: 'a' was not declared in this scope 30 | for (int j = 0; j < a[i]; j++) | ^ a.cc:32:17: error: 'd' was not declared in this scope 32 | d[idx++] = i+1; | ^ a.cc:38:13: error: 'string' was not declared in this scope 38 | string s = ""; | ^~~~~~ a.cc:39:31: error: 'w' was not declared in this scope 39 | int baseIdx = i * w; | ^ a.cc:45:21: error: 's' was not declared in this scope 45 | s += d[baseIdx + j].ToString(); | ^ a.cc:45:26: error: 'd' was not declared in this scope 45 | s += d[baseIdx + j].ToString(); | ^ a.cc:52:21: error: 's' was not declared in this scope 52 | s += d[baseIdx + j].ToString(); | ^ a.cc:52:26: error: 'd' was not declared in this scope 52 | s += d[baseIdx + j].ToString(); | ^ a.cc:56:23: error: 's' was not declared in this scope 56 | WriteLine(s); | ^ a.cc:56:13: error: 'WriteLine' was not declared in this scope 56 | WriteLine(s); | ^~~~~~~~~
s412519675
p03640
C++
#include <bits/stdc++.h> using namespace std; int main() { int H,W,N; cout << H << W << N; int a[N]; vector<int> vec; for(int i=0;i<N;i++){ cin << a[i]; for(int j=0;j<a[i];j++){ vec.push_back(i); } } for(int i=0;i<H;i++){ if(i%2==0){ int x=vec.front(); vec.erase(vec.begin()); cout << x+1 << ' '; } else{ vector<int> veve; for(int j=0;j<W;j++){ veve.push_back(vec.front()); vec.erase(vec.begin()); } veve.reverse(); for(int j=0;j<W;j++){ cout << veve.front()+1 << ' '; veve.erase(veve.begin()); } } } }
a.cc: In function 'int main()': a.cc:10:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 10 | cin << a[i]; | ~~~ ^~ ~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:10:9: note: candidate: 'operator<<(int, int)' (built-in) 10 | cin << a[i]; | ~~~~^~~~~~~ a.cc:10:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:10:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 10 | cin << a[i]; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 10 | cin << a[i]; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:10:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 10 | cin << a[i]; |
s425353350
p03640
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<bool> vb; typedef vector<int> vi; typedef pair<ll, ll> pll; typedef vector<pll> vpll; const ll LINF = 1ll << 55; const ll INF = 0x3f3f3f3f; const ll MOD = 1e9 + 7; const int MAXN = 1e9 + 10; const ll dx[] = {1, 0, -1, 0}; const ll dy[] = {0, 1, 0, -1}; /// cin/cout overload template<typename T> ostream& operator<< (ostream& out, vector<T>& vec) { for (auto it = vec.begin(); it != vec.end() - 1; ++it) { out << *it << " "; } out << *it; return out; } template<typename T> istream& operator>> (istream& in, vector<T>& vec) { for (auto it = vec.begin(); it != vec.end(); ++it) { in >> *it; } return in; } /// 图相关 //ll N, M; // //struct Edge { // ll to; // ll weight; // ll next; //}; //vector<Edge> edges(MAXN); //vector<ll> head(MAXN, -1); //vector<int> matchingx(MAXN, -1); //vector<int> matchingy(MAXN, -1); //vector<bool> check(MAXN); //vector<ll> dis(MAXN); //vector<bool> vis(MAXN, false); // //ll cnt = 1; // //void addEdge(ll from, ll to, ll weight) { // edges[cnt].to = to; // edges[cnt].weight = weight; // edges[cnt].next = head[from]; // head[from] = cnt++; //} // //bool dfs(int u) { // for (int i = head[u]; i != -1; i = edges[i].next) { // int v = edges[i].to; // if (!check[v]) { // check[v] = true; // if (matchingy[v] == -1 || dfs(matchingy[v])) { // matchingy[v] = u; // matchingx[u] = v; // return true; // } // } // } // return false; //} // //int hungarian() { // int ans = 0; // fill(matchingx.begin(), matchingx.end(), -1); // fill(matchingy.begin(), matchingy.end(), -1); // for (int u = 1; u <= N; ++u) { //// if (matchingx[u] == -1) { // { // fill(check.begin(), check.end(), false); // if (dfs(u)) { // ++ans; // } // } // } // return ans; //} // //void dijkstra(const ll s) { // priority_queue<P, vector<P>, greater<P>> que; // fill(dis.begin(), dis.end(), INF); // dis[s] = 0; // que.push(P(0, s)); //////multiple sources //// for (auto& x : shops) { //// dis[x] = 0; //// que.push(P(0, x)); //// } // while (!que.empty()) { // P p = que.top(); // que.pop(); //// cout << "pop " << p.second << endl; // int u = p.second; // if (dis[u] < p.first) continue; // for (int i = head[u]; i != -1; i = edges[i].next) { // int v = edges[i].to; // if (dis[v] > dis[u] + edges[i].weight) { // dis[v] = dis[u] + edges[i].weight; //// cout << "push " << v << endl; // que.push(P(dis[v], v)); // } // } // } //} //void zeroOneBFS(const int s) { // deque<P> que; // fill(dis.begin(), dis.end(), INF); // dis[s] = 0; // que.push_front(P(0, s)); // while (!que.empty()) { // P p = que.front(); // que.pop_front(); // int u = p.second; // if (dis[u] < p.first) continue; // for (int i = head[u]; i != -1; i = edges[i].next) { // int v = edges[i].to; // if (dis[v] > dis[u] + edges[i].weight) { // dis[v] = dis[u] + edges[i].weight; // if (edges[i].weight) { // que.push_back(P(dis[v], v)); // } else { // que.push_front(P(dis[v], v)); // } // } // } // } //} // //struct TreeNode { // int val; // TreeNode* left = nullptr; // TreeNode* right = nullptr; // TreeNode(int val_) : val(val_) {} //}; // ////int dfs(int cur, int a, int b, int c, const vector<int> &nums) { //// if (cur >= N) { //// return (min({a, b, c}) > 0 ? (abs(a - A) + abs(b - B) + abs(c - C) - 30) : INF); //// } //// int ret0 = dfs(cur + 1, a, b, c, nums); //// int ret1 = dfs(cur + 1, a + nums[cur], b, c, nums) + 10; //// int ret2 = dfs(cur + 1, a, b + nums[cur], c, nums) + 10; //// int ret3 = dfs(cur + 1, a, b, c + nums[cur], nums) + 10; //// return min({ret0, ret1, ret2, ret3}); ////} // //struct HuffmanNode : std::enable_shared_from_this<HuffmanNode> { // typedef std::shared_ptr<HuffmanNode> HuffmanNodePtr; // int weight; // HuffmanNodePtr leftChild; // HuffmanNodePtr rightChild; // HuffmanNodePtr parent; // explicit HuffmanNode(int weight_) : weight(weight_), leftChild(nullptr), rightChild(nullptr) {} // bool operator<(const HuffmanNode &rhs) const { // return weight > rhs.weight; // } //}; // ////struct cmp { //// bool operator () (const HuffmanNodePtr x, const HuffNode* y) { //// return x->weight > y->weight; //// } ////}; // //class KthLargest { //public: // KthLargest(int k, vector<int> nums) { // this->k = k; // for (auto &x : nums) { // add(x); // } // } // // int add(int val) { // maxHeap.push(-val); // if (maxHeap.size() > k) { // maxHeap.pop(); // } // return -maxHeap.top(); // } //private: // priority_queue<int> maxHeap; // int k; //}; // // //int bfs() { // queue<P> que; // for (int i = 0; i < MAXN; ++i) { // for (int j = 0; j < MAXN; ++j) { // dis[i][j] = INF; // } // } // dis[sx][sy] = 0; // que.push(P(sx, sy)); // while (!que.empty()) { // auto p = que.top(); // que.pop(); // if (p.first == gx && p.second == gy) break; // for (int i = 0; i < 4; ++i) { // int nx = p.first + dx[i]; // int ny = p.second + dy[i]; // if (nx >= 0 && nx < N && ny >= 0 && ny < M && maze[nx][ny] != '#' && dis[nx][ny] == INF) { // que.push(P(nx, ny)); // dis[nx][ny] = dis[p.first][p.second] + 1; // } // } // } // return dis[gx][gy]; //} // /// Union-Find 并查集 //class UnionFind { // vector<int> par; //public: // explicit UnionFind(int n) : par(n, -1) {} // // int root(int a) { // if (par[a] < 0) { // return a; // } // return par[a] = root(par[a]); // } // // int size(int a) { // return -par[root(a)]; // } // // void unite(int a, int b) { // a = root(a); // b = root(b); // if (a != b) { // if (size(a) < size(b)) { // swap(a, b); // } // par[a] += par[b]; // par[b] = a; // } // } //}; /// 线段树 //struct SegmentTreeNode { // ll maxVal; // ll minVal; // ll sum; // ll len; // ll lazy; // ll left, right; // SegmentTreeNode() {} //}; // //class SegmentTree { //public: // explicit SegmentTree(size_t size, const vll& nums) : tree(size << 2), nums(nums) { // // } // void build(ll root, ll left, ll right) { // tree[root].lazy = 0; // tree[root].left = left; // tree[root].right = right; // tree[root].len = right - left + 1; // if (left == right) { // tree[root].maxVal = nums[left]; // tree[root].minVal = nums[left]; // tree[root].sum = nums[left]; // } else { // ll mid = (right - left) / 2 + left; // build(root * 2, left, mid); // build(root * 2 + 1, mid + 1, right); // tree[root].minVal = min(tree[root * 2].minVal, tree[root * 2 + 1].minVal); // tree[root].maxVal = max(tree[root * 2].maxVal, tree[root * 2 + 1].maxVal); // tree[root].sum = tree[root * 2].sum + tree[root * 2 + 1].sum; // } // } // // void pushup(ll root) { // tree[root].minVal = min(tree[root * 2].minVal, tree[root * 2 + 1].minVal); // tree[root].maxVal = max(tree[root * 2].maxVal, tree[root * 2 + 1].maxVal); // tree[root].sum = tree[root * 2].sum + tree[root * 2 + 1].sum; // } ////// add single node val // void add(ll root, ll id, ll addVal) { // if (tree[root].left == tree[root].right) { // tree[root].maxVal += addVal; // tree[root].minVal += addVal; // tree[root].sum += addVal; // return; // } // ll mid = (tree[root].right - tree[root].left) / 2 + tree[root].left; // if (id <= mid) { // add(root * 2, id, addVal); // } else { // add(root * 2 + 1, id, addVal); // } // pushup(root); // } // // void pushdown(ll root) { // if (tree[root].lazy) { // tree[root * 2].lazy += tree[root].lazy; // tree[root * 2 + 1].lazy += tree[root].lazy; // tree[root * 2].sum += tree[root * 2].len * tree[root].lazy; // tree[root * 2 + 1].sum += tree[root * 2 + 1].len * tree[root].lazy; // tree[root * 2].maxVal += tree[root].lazy; // tree[root * 2 + 1].maxVal += tree[root].lazy; // tree[root * 2].minVal += tree[root].lazy; // tree[root * 2 + 1].minVal += tree[root].lazy; // tree[root].lazy = 0; // } // } // //// query range sum // ll querySum(ll root, ll left, ll right) { // if (tree[root].left >= left && tree[root].right <= right) { // return tree[root].sum; // } // if (tree[root].left > right || tree[root].right < left) { // return 0; // } // if (tree[root].lazy) { // pushdown(root); // } // return querySum(root * 2, left, right) + querySum(root * 2 + 1, left, right); // } // //// query range max/min // ll queryMax(ll root, ll left, ll right) { // if (tree[root].left >= left && tree[root].right <= right) { // return tree[root].maxVal; // } // if (tree[root].left > right || tree[root].right < left) { // return -INF; // } // if (tree[root].lazy) { // pushdown(root); // } // return max(queryMax(root * 2, left, right), queryMax(root * 2 + 1, left, right)); // } // // ll queryMin(ll root, ll left, ll right) { // if (tree[root].left >= left && tree[root].right <= right) { // return tree[root].minVal; // } // if (tree[root].left > right || tree[root].right < left) { // return INF; // } // if (tree[root].lazy) { // pushdown(root); // } // return min(queryMin(root * 2, left, right), queryMin(root * 2 + 1, left, right)); // } // //// add range val // void update(ll root, ll left, ll right, ll addVal) { // if (tree[root].left >= left && tree[root].right <= right) { // tree[root].lazy += addVal; // tree[root].sum += tree[root].len * addVal; // tree[root].maxVal += addVal; // tree[root].minVal += addVal; // return; // } // if (tree[root].left > right || tree[root].right < left) { // return; // } // if (tree[root].lazy) { // pushdown(root); // } // update(root * 2, left, right, addVal); // update(root * 2 + 1, left, right, addVal); // pushup(root); // } // // //private: // vector<SegmentTreeNode> tree; // const vll &nums; //}; /// 组合数 ////約数求める //約数 //void divisor(ll n, vector<ll> &ret) { // for (ll i = 1; i * i <= n; i++) { // if (n % i == 0) { // ret.push_back(i); // if (i * i != n) ret.push_back(n / i); // } // } // sort(ret.begin(), ret.end()); //} ////階乗 //ll factorial(ll n, ll mod) { // ll ret = 1; // for (ll i = 1; i <= n; i++) { // ret = (ret * i) % mod; // } // return ret; //} ////モジュラ逆数 //ll inv_mod(ll n, ll mod) { // ll a = n % mod, b = mod - 2, ret = 1; // while (b > 0) { // if (b & 1) ret = (ret * a) % mod; // a = (a * a) % mod; // b >>= 1; // } // return ret; //} // //ll nPr(ll n, ll r, ll mod) { // ll ret = 1; // for (ll i = n; i >= n - r + 1; i--) { // ret = ret * (i % mod) % mod; // } // return ret; //} // //ll nCr(ll n, ll r, ll mod) { // return nPr(n, r, mod) * inv_mod(factorial(r, mod), mod) % mod; //} // //vll F(MAXN), Finv(MAXN), inv(MAXN); // //ll pow_mod(ll a, ll b, ll p) { // ll ret = 1; // while (b) { // if (b & 1) ret = (ret * a) % p; // a = (a * a) % p; // b >>= 1; // } // return ret; //} // //void comb_init() { // inv[1] = 1; // for (int i = 2; i < MAXN; ++i) { // inv[i] = (MOD - MOD / i) * 1ll * inv[MOD % i] % MOD; // } // F[0] = Finv[0] = 1; // for (int i = 1; i < MAXN; ++i) { // F[i] = F[i-1] * 1ll * i % MOD; // Finv[i] = Finv[i-1] * 1ll * inv[i] % MOD; // } //} // //inline ll comb(ll n, ll m) { // if (m < 0 || m > n) return 0; // return F[n] * 1ll * Finv[n - m] % MOD * Finv[m] % MOD; //} // //inline ll add_mod(ll a, ll b) { // return (a + b) % MOD; //} // //inline ll mul_mod(ll a, ll b) { // return a * b % MOD; //} // //inline ll sub_mod(ll a, ll b) { // return (a + MOD - b) % MOD; //} /// 自定义类型以及hash struct UVK { ll u; ll v; ll k; UVK(ll u_, ll v_, ll k_) : u(u_), v(v_), k(k_) {} bool operator< (const UVK& rhs) const { return (u < rhs.u) || (u == rhs.u && v < rhs.v) || (u == rhs.u && v == rhs.v && k < rhs.k); } }; struct UVKHash { ll operator() (const UVK& uvk) const { return ((hash<ll>()(uvk.u) ^ (hash<ll>()(uvk.v) << 1)) >> 1) ^ (hash<ll>()(uvk.k) << 1); } }; struct UVKComparator { bool operator() (const UVK& x, const UVK& y) const { return x.u == y.u && x.v == y.v && x.k == y.k; } }; /// AC自动机,禁止字符串 //const ll maxnode = 100 + 20; //ll sigma_size;//后面读入 // //struct AC_Automata //{ // ll ch[maxnode][100+20]; // ll match[maxnode]; // ll f[maxnode]; // map<char, ll> mp; // ll sz; // void init() // { // sz=1; // memset(ch[0],0,sizeof(ch[0])); // match[0]=f[0]=0; // mp.clear(); // } // void insert(string s) // { // ll n = s.size(); // ll u = 0; // for(int i=0;i<n;i++) // { // ll id = mp[s[i]]; // if(ch[u][id]==0) // { // ch[u][id]=sz; // memset(ch[sz],0,sizeof(ch[sz])); // match[sz++]=0; // } // u=ch[u][id]; // } // match[u]=1; // } // void getFail() // { // f[0]=0; // queue<ll> q; // for(int i=0;i<sigma_size;i++) // { // ll u=ch[0][i]; // if(u) // { // f[u]=0; // q.push(u); // } // } // while(!q.empty()) // { // ll r=q.front();q.pop(); // for(ll i=0;i<sigma_size;i++) // { // ll u=ch[r][i]; // if(!u) { ch[r][i]=ch[f[r]][i]; continue; } // q.push(u); // ll v = f[r]; // while (v && ch[v][i] == 0) v=f[v]; // f[u] = ch[v][i]; // match[u] |= match[f[u]]; // } // } // } //}; //AC_Automata ac; //vector<vector<ll>> dp(MAXN, vector<ll>(MAXN)); // //int main() //{ // // 字符集数目 // ll n = 4; // // 字符串长度 // ll m; // // 禁止字符串个数 // ll p = 9; // string str; // cin >> m; // sigma_size=n; // ac.init(); // // 初始化字符 // str = "AGCT"; // for(int i=0;i<n;i++) // ac.mp[str[i]]=i; // // 插入禁止字符串 // ac.insert("AGC"); // ac.insert("ACG"); // ac.insert("GAC"); // ac.insert("AGGC"); // ac.insert("ACGC"); // ac.insert("ATGC"); // ac.insert("AGAC"); // ac.insert("AGGC"); // ac.insert("AGTC"); // ac.getFail(); // // dp[0][0] = 1; // for(int k=0;k<m;k++) // { // for(int i=0;i<ac.sz;i++) // if(ac.match[i]==0) // for(int j=0;j<sigma_size;j++) // if(ac.match[ac.ch[i][j]]==0) // dp[ac.ch[i][j]][k+1] = add_mod(dp[ac.ch[i][j]][k+1],dp[i][k]); // } // ll ans = 0; // for(int i=0;i<ac.sz;i++)if(ac.match[i]==0) // ans = add_mod(ans,dp[i][m]); // cout << ans << endl; // // return 0; //} /// ConvexHullTrick // class ConvexHullTrick { // vll A, B; // ll len = 0; // inline bool check(ll a, ll b) { // return (B[len - 2] - B[len - 1]) * (a - A[len - 1]) >= (B[len - 1] - b) * (A[len - 1] - A[len - 2]); // } // inline ll get(ll k, ll x) { // return A[k] * x + B[k]; // } // public: // explicit ConvexHullTrick(ll n) : A(n), B(n) {} // void addline(ll a, ll b) { // while (len >= 2 && check(a, b)) { // --len; // } // A[len] = a; // B[len] = b; // ++len; // } // ll query(ll x) { // ll l = -1; // ll r = len - 1; // while (r - l > 1) { // ll mid = (r - l) / 2 + l; // if (get(mid, x) >= get(mid + 1, x)) { // l = mid; // } else { // r = mid; // } // } // return get(r, x); // } // }; // /// 求逆序 // ll getInversePair(vector<ll>& nums, int start, int end, vector<ll>& copy) { // if (start >= end) { // return 0; // } // int mid = (end - start) / 2 + start; // ll leftCnt = getInversePair(nums, start, mid, copy); // ll rightCnt = getInversePair(nums, mid + 1, end, copy); // int p = start; // int q = mid + 1; // int index = start; // ll cnt = 0; // while (p <= mid && q <= end) { // if (nums[p] <= nums[q]) { // copy[index++] = nums[p++]; // cnt += end - q + 1; // } else { // copy[index++] = nums[q++]; // } // } // while (p <= mid) copy[index++] = nums[p++]; // while (q <= end) copy[index++] = nums[q++]; // for (int i = start; i <= end; ++i) { // nums[i] = copy[i]; // } // return (leftCnt + rightCnt + cnt); // } /// main函数 int main() { ll H, W, N; cin >> H >> W >> N; vll a(N); cin >> a; vector<vll> grid(H, vll(W)); int ix = 0; int iy = 0; ll remain; bool right = true; for (int i = 0; i < N; ++i) { remain = a[i]; while (remain --) { grid[ix][iy] = i + 1; if (right) { ++iy; if (iy >= W) { --iy; ++ix; right = false; } } else { --iy; if (iy < 0) { ++iy; ++ix; right = true; } } } } for (int i = 0; i < H; ++i) { cout << grid[i] << endl; } return 0; }
a.cc: In function 'std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)': a.cc:25:13: error: 'it' was not declared in this scope; did you mean 'int'? 25 | out << *it; | ^~ | int
s870921572
p03640
C++
#define debug_interval ',' #define dump_interval ' ' #define debug_toggle 1 //{ #pragma GCC optimize ("O3","unroll-loops") #pragma GCC target ("avx") #include<bits/stdc++.h> using namespace std; #define hi cerr<<"hi"<<endl; #define int long long #define INT_MAX LLONG_MAX #define rep(i,n) for(int i=0;i<(n);i++) #define rep1(i,n) for(int i=1;i<=(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define fi first #define se second #define mp make_pair #define rev reverse #define dans dump(ans) #define MOD 1000000007 #define amp(v,n) (v).count(n)?v[n]++:v[n]=1 #define sysp system("pause") #define PI acos(-1) #define ins insert #define aer(v) (v).erase((v).begin(),(v).end()) //{ inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();} template<class...A> inline void dump(){cout<<endl;} template<class...A> inline void dump_rest() {cout<<endl;} template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);} template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);} template<class...A> inline void debug(){cerr<<endl;} template<class...A> inline void debug_rest() {cerr<<endl;} template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);} template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);} //} typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}}; //} int h,w,n,px,py,dy[]={1,0,-1,0},dx[]={0,1,0,-1}; int f[111][111]; int d; bool cango(int y,int x){ return y>=0&&y<h&&x>=0&&x<w&&f[y][x]==0; } void walk(int cn,int v){ if(v==0)return; f[py][px]=cn; /*bool test=cango(py+dy[d%4],px+dx[d%4]); cout<<test<<endl; rep(i,h+5){ rep(j,w+5){ cerr<<f[i][j]; } cout<<endl; } cout<<endl;*/ v--; if(cango(py+dy[d%4],px+dx[d%4])==0)d++; py+=dy[d%4];px+=dx[d%4]; walk(cn,v); } main(){ cin>>h>>w>>n; for(int c=1;c<n+1;c++){ int a; cin>>a; walk(c,a); } rep(i,h){ rep(j,w){ cout<<f[i][j]<<(j+1==w?/n:' '); } } }
a.cc:12:9: warning: "INT_MAX" redefined 12 | #define INT_MAX LLONG_MAX | ^~~~~~~ In file included from /usr/include/c++/14/climits:42, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:38, from a.cc:8: /usr/lib/gcc/x86_64-linux-gnu/14/include/limits.h:120:9: note: this is the location of the previous definition 120 | #define INT_MAX __INT_MAX__ | ^~~~~~~ a.cc:79:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 79 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:90:48: error: expected primary-expression before '/' token 90 | cout<<f[i][j]<<(j+1==w?/n:' '); | ^
s821024782
p03640
C++
#define debug_interval ',' #define dump_interval ' ' #define debug_toggle 1 //{ #pragma GCC optimize ("O3","unroll-loops") #pragma GCC target ("avx") #include<bits/stdc++.h> using namespace std; #define hi cerr<<"hi"<<endl; #define int long long #define INT_MAX LLONG_MAX #define rep(i,n) for(int i=0;i<(n);i++) #define rep1(i,n) for(int i=1;i<=(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define fi first #define se second #define mp make_pair #define rev reverse #define dans dump(ans) #define MOD 1000000007 #define amp(v,n) (v).count(n)?v[n]++:v[n]=1 #define sysp system("pause") #define PI acos(-1) #define ins insert #define aer(v) (v).erase((v).begin(),(v).end()) //{ inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();} template<class...A> inline void dump(){cout<<endl;} template<class...A> inline void dump_rest() {cout<<endl;} template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);} template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);} template<class...A> inline void debug(){cerr<<endl;} template<class...A> inline void debug_rest() {cerr<<endl;} template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);} template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);} //} typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}}; //} int h,w,n,px,py,dy[]={1,0,-1,0},dx[]={0,1,0,-1}; int f[111][111]; int d; bool cango(int y,int x){ return y>=0&&y<h&&x>=0&&x<w&&f[y][x]==0; } void walk(int cn,int v){ if(v==0)return; f[py][px]=cn; /*bool test=cango(py+dy[d%4],px+dx[d%4]); cout<<test<<endl; rep(i,h+5){ rep(j,w+5){ cerr<<f[i][j]; } cout<<endl; } cout<<endl;*/ v--; if(cango(py+dy[d%4],px+dx[d%4])==0)d++; py+=dy[d%4];px+=dx[d%4]; walk(cn,v); } main(){ cin>>h>>w>>n; for(int c=1;c<n+1;c++){ int a; cin>>a; walk(c,a); } rep(i,h){ rep(j,w){ cout<<f[i][j]<<(j+1==w?\n:' '); } } }
a.cc:12:9: warning: "INT_MAX" redefined 12 | #define INT_MAX LLONG_MAX | ^~~~~~~ In file included from /usr/include/c++/14/climits:42, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:38, from a.cc:8: /usr/lib/gcc/x86_64-linux-gnu/14/include/limits.h:120:9: note: this is the location of the previous definition 120 | #define INT_MAX __INT_MAX__ | ^~~~~~~ a.cc:90:48: error: stray '\' in program 90 | cout<<f[i][j]<<(j+1==w?\n:' '); | ^ a.cc:79:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 79 | main(){ | ^~~~
s385121332
p03640
C++
#include <iostream> #include <vector> #include <math.h> #include <cmath> #include <algorithm> #include <numeric> #include <string> #include <cstring> #include <regex> #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,int>; using pl4 = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; using vs = vector<string>; using vvs = vector<vs>; using vll = vector<ll>; using vvll = vector<vll>; using vpii = vector<pii>; using vvpii = vector<vpii>; using vpl4 = vector<pl4>; using vvpl4 = vector<vpl4>; #define fi first #define se second #define mp make_pair #define pb push_back #define pob pop_back() #define sz size() #define be begin() #define en end() #define asn assign #define emp empty() #define ft front() #define bk back() #define clr clear() #define ins insert #define ers erase #define res resize #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define rFOR(i,a,b) for(int i=(b);i>=(a);i--) #define REP(i,a) for(int i=0;i<(a);i++) #define REP1(i,a) for(int i=1;i<=(a);i++) #define rREP(i,a) for(int i=(a-1);i>=0;i--) #define rREP1(i,a) for(int i=(a);i>0;i--) #define SORT(a) sort((a).be,(a).en) #define rSORT(a) sort((a).rbegin(),(a).rend()) #define UNIQUE(a) (a).erase(unique((a).be,(a).en),(a).en) #define PREVP(a) prev_permutation((a).be,(a).en) #define NEXTP(a) next_permutation((a).be,(a).en) #define BINS(a,b) binary_search((a).be,(a).en,(b)) #define LOWB(a,b) (lower_bound((a).be,(a).en,(b))-(a).be) #define UPB(a,b) (upper_bound((a).be,(a).en,(b))-(a).be) #define CNT(a,b) count((a).be,(a).en,b) #define SUM(a) accumulate((a).be,(a).en,0) #define REV(a) reverse((a).be,(a).en) #define REGS(a,b) regex_search((a),regex(b)) #define REGM(a,b) regex_match((a),regex(b)) #define yn(a) cout <<((a)?"yes":"no")<<endl; #define Yn(a) cout <<((a)?"Yes":"No")<<endl; #define YN(a) cout <<((a)?"YES":"NO")<<endl; #define say(a) cout <<(a); #define sal(a) cout <<(a)<<endl; #define sak cout <<endl; #define dbg(a) cout <<(#a)<<": "<<(a)<<endl; #define a2l(a) ((ll)(a-97)) #define A2l(a) ((ll)(a-65)) #define l2a(a) ((char)(a+97)) #define l2A(a) ((char)(a+65)) #define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1)) #define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1)) #define Dig2(a,b) (((a)>>(b))&1) #define Dig10(a,b) (ll)(((a)/((ll)(pow(10.0,(double)(b)))))%10) #define Pow2(a) (1<<(a)) #define llin(a) ll (a);cin >>(a); #define stin(a) string (a);cin >>(a); #define rdn(a,b) ((a)/(b)) #define rou(a,b) ((((double(a)/double(b))-((a)/(b)))<0.5)?((a)/(b)):(((a)/(b))+1)) #define rup(a,b) ((((a)%(b))==0)?((a)/(b)):(((a)/(b))+1)) #define min(a,b) ((a<b)?(a):(b)) #define max(a,b) ((a>b)?(a):(b)) #define int ll const ll MOD = 1e9+7; const string alp = "abcdefghijklmnopqrstuvwxyz"; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);} ll lcm(ll a, ll b){return a/gcd(a,b)*b;} ll sgn(ll n){ if(n==0) return 0; else return n/abs(n); } ll salv(vll v){ say("{"); FOR(i,0,v.sz-1){ say(v[i]); if(i!=v.sz-1) say(","); } sal("}") } ll DigS10(ll n){ ll m=0; FOR(i,0,DigN10(n)-1){ m+=(ll)((llabs(n)%(ll)(pow(10.0,(double)(i+1))))/(ll)(pow(10.0,(double)i))); } return m; } ll isP(ll n){ if(n<=1) return 0; FOR(i,2,(ll)sqrt(n)){ if(n%i==0) return 0; } return 1; } vll FactM(1,1); vll FactMI(1,1); ll PowM(ll a,ll b){ ll ans=1,x=(a%MOD); FOR(i,0,DigN2(b)-1){ if(Dig2(b,i)==1) ans=(ans*x)%MOD; if(i!=(DigN2(b)-1)) x=(x*x)%MOD; } return ans; } void CFactM(ll n){ FOR(i,FactM.sz,n){ FactM.pb((FactM[i-1]*(i%MOD))%MOD); } return; } void CFactMI(ll n){ CFactM(n); if(FactMI.sz<(n+1)) FactMI.res(n+1,-1); if(FactMI[n]==-1) FactMI[n]=PowM(FactM[n],MOD-2); rFOR(i,1,n-1){ if(FactMI[i]!=-1) break; FactMI[i]=((FactMI[i+1]*((i+1)%MOD))%MOD); } return; } ll CombM(ll n,ll k){ if((n<0)||(k<0)) return 0; if(n<k) return 0; if(n+1>FactMI.sz) CFactMI(n); return ((((FactMI[k]*FactMI[n-k])%MOD)*FactM[n])%MOD); } signed main() { ll h,w,n,a[101],b[100][100]=0,x=0,y=0; cin >> h >> w >> n; REP1(i,n){ cin >> a[i]; } REP1(i,n){ REP(j,a[i]){ b[x][y] = i; if(y%2&&x==0){ y++; } else if (y%2==0&&x==w-1) { y++; } else if (y%2) { x--; } else if (y%2) { x++; } } } REP(i,h){ REP(j,w){ cout << b[x][y] << " "; } cout << endl; } return 0; }
a.cc: In function 'll salv(vll)': a.cc:109:1: warning: no return statement in function returning non-void [-Wreturn-type] 109 | } | ^ a.cc: In function 'int main()': a.cc:165:31: error: array must be initialized with a brace-enclosed initializer 165 | ll h,w,n,a[101],b[100][100]=0,x=0,y=0; | ^
s661689093
p03640
C++
#include <iostream> #include <vector> #include <math.h> #include <cmath> #include <algorithm> #include <numeric> #include <string> #include <cstring> #include <regex> #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,int>; using pl4 = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; using vs = vector<string>; using vvs = vector<vs>; using vll = vector<ll>; using vvll = vector<vll>; using vpii = vector<pii>; using vvpii = vector<vpii>; using vpl4 = vector<pl4>; using vvpl4 = vector<vpl4>; #define fi first #define se second #define mp make_pair #define pb push_back #define pob pop_back() #define sz size() #define be begin() #define en end() #define asn assign #define emp empty() #define ft front() #define bk back() #define clr clear() #define ins insert #define ers erase #define res resize #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define rFOR(i,a,b) for(int i=(b);i>=(a);i--) #define REP(i,a) for(int i=0;i<(a);i++) #define REP1(i,a) for(int i=1;i<=(a);i++) #define rREP(i,a) for(int i=(a-1);i>=0;i--) #define rREP1(i,a) for(int i=(a);i>0;i--) #define SORT(a) sort((a).be,(a).en) #define rSORT(a) sort((a).rbegin(),(a).rend()) #define UNIQUE(a) (a).erase(unique((a).be,(a).en),(a).en) #define PREVP(a) prev_permutation((a).be,(a).en) #define NEXTP(a) next_permutation((a).be,(a).en) #define BINS(a,b) binary_search((a).be,(a).en,(b)) #define LOWB(a,b) (lower_bound((a).be,(a).en,(b))-(a).be) #define UPB(a,b) (upper_bound((a).be,(a).en,(b))-(a).be) #define CNT(a,b) count((a).be,(a).en,b) #define SUM(a) accumulate((a).be,(a).en,0) #define REV(a) reverse((a).be,(a).en) #define REGS(a,b) regex_search((a),regex(b)) #define REGM(a,b) regex_match((a),regex(b)) #define yn(a) cout <<((a)?"yes":"no")<<endl; #define Yn(a) cout <<((a)?"Yes":"No")<<endl; #define YN(a) cout <<((a)?"YES":"NO")<<endl; #define say(a) cout <<(a); #define sal(a) cout <<(a)<<endl; #define sak cout <<endl; #define dbg(a) cout <<(#a)<<": "<<(a)<<endl; #define a2l(a) ((ll)(a-97)) #define A2l(a) ((ll)(a-65)) #define l2a(a) ((char)(a+97)) #define l2A(a) ((char)(a+65)) #define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1)) #define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1)) #define Dig2(a,b) (((a)>>(b))&1) #define Dig10(a,b) (ll)(((a)/((ll)(pow(10.0,(double)(b)))))%10) #define Pow2(a) (1<<(a)) #define llin(a) ll (a);cin >>(a); #define stin(a) string (a);cin >>(a); #define rdn(a,b) ((a)/(b)) #define rou(a,b) ((((double(a)/double(b))-((a)/(b)))<0.5)?((a)/(b)):(((a)/(b))+1)) #define rup(a,b) ((((a)%(b))==0)?((a)/(b)):(((a)/(b))+1)) #define min(a,b) ((a<b)?(a):(b)) #define max(a,b) ((a>b)?(a):(b)) #define int ll const ll MOD = 1e9+7; const string alp = "abcdefghijklmnopqrstuvwxyz"; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);} ll lcm(ll a, ll b){return a/gcd(a,b)*b;} ll sgn(ll n){ if(n==0) return 0; else return n/abs(n); } ll salv(vll v){ say("{"); FOR(i,0,v.sz-1){ say(v[i]); if(i!=v.sz-1) say(","); } sal("}") } ll DigS10(ll n){ ll m=0; FOR(i,0,DigN10(n)-1){ m+=(ll)((llabs(n)%(ll)(pow(10.0,(double)(i+1))))/(ll)(pow(10.0,(double)i))); } return m; } ll isP(ll n){ if(n<=1) return 0; FOR(i,2,(ll)sqrt(n)){ if(n%i==0) return 0; } return 1; } vll FactM(1,1); vll FactMI(1,1); ll PowM(ll a,ll b){ ll ans=1,x=(a%MOD); FOR(i,0,DigN2(b)-1){ if(Dig2(b,i)==1) ans=(ans*x)%MOD; if(i!=(DigN2(b)-1)) x=(x*x)%MOD; } return ans; } void CFactM(ll n){ FOR(i,FactM.sz,n){ FactM.pb((FactM[i-1]*(i%MOD))%MOD); } return; } void CFactMI(ll n){ CFactM(n); if(FactMI.sz<(n+1)) FactMI.res(n+1,-1); if(FactMI[n]==-1) FactMI[n]=PowM(FactM[n],MOD-2); rFOR(i,1,n-1){ if(FactMI[i]!=-1) break; FactMI[i]=((FactMI[i+1]*((i+1)%MOD))%MOD); } return; } ll CombM(ll n,ll k){ if((n<0)||(k<0)) return 0; if(n<k) return 0; if(n+1>FactMI.sz) CFactMI(n); return ((((FactMI[k]*FactMI[n-k])%MOD)*FactM[n])%MOD); } signed main() { ll h,w,n,a[101],b[100][100]=0,x=0,y=0; cin >> h >> w >> n; REP1(i,n){ cin >> a[i]; } REP1(i,n){ REP(j,a[i]){ b[x][y] = i; if(y%2&&x==0){ y++; } else if (y%2==0&&x==w-1) { y++; } else if (y%2) { x--; } else if (y%2) { x++; } } REP(i,h){ REP(j,w){ cout << b[x][y] << " "; } cout << endl; } return 0; }
a.cc: In function 'll salv(vll)': a.cc:109:1: warning: no return statement in function returning non-void [-Wreturn-type] 109 | } | ^ a.cc: In function 'int main()': a.cc:165:31: error: array must be initialized with a brace-enclosed initializer 165 | ll h,w,n,a[101],b[100][100]=0,x=0,y=0; | ^ a.cc:190:2: error: expected '}' at end of input 190 | } | ^ a.cc:164:15: note: to match this '{' 164 | signed main() { | ^
s928132037
p03640
C++
#include <iostream> #include <vector> #include <math.h> #include <cmath> #include <algorithm> #include <numeric> #include <string> #include <cstring> #include <regex> #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,int>; using pl4 = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; using vs = vector<string>; using vvs = vector<vs>; using vll = vector<ll>; using vvll = vector<vll>; using vpii = vector<pii>; using vvpii = vector<vpii>; using vpl4 = vector<pl4>; using vvpl4 = vector<vpl4>; #define fi first #define se second #define mp make_pair #define pb push_back #define pob pop_back() #define sz size() #define be begin() #define en end() #define asn assign #define emp empty() #define ft front() #define bk back() #define clr clear() #define ins insert #define ers erase #define res resize #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define rFOR(i,a,b) for(int i=(b);i>=(a);i--) #define REP(i,a) for(int i=0;i<(a);i++) #define REP1(i,a) for(int i=1;i<=(a);i++) #define rREP(i,a) for(int i=(a-1);i>=0;i--) #define rREP1(i,a) for(int i=(a);i>0;i--) #define SORT(a) sort((a).be,(a).en) #define rSORT(a) sort((a).rbegin(),(a).rend()) #define UNIQUE(a) (a).erase(unique((a).be,(a).en),(a).en) #define PREVP(a) prev_permutation((a).be,(a).en) #define NEXTP(a) next_permutation((a).be,(a).en) #define BINS(a,b) binary_search((a).be,(a).en,(b)) #define LOWB(a,b) (lower_bound((a).be,(a).en,(b))-(a).be) #define UPB(a,b) (upper_bound((a).be,(a).en,(b))-(a).be) #define CNT(a,b) count((a).be,(a).en,b) #define SUM(a) accumulate((a).be,(a).en,0) #define REV(a) reverse((a).be,(a).en) #define REGS(a,b) regex_search((a),regex(b)) #define REGM(a,b) regex_match((a),regex(b)) #define yn(a) cout <<((a)?"yes":"no")<<endl; #define Yn(a) cout <<((a)?"Yes":"No")<<endl; #define YN(a) cout <<((a)?"YES":"NO")<<endl; #define say(a) cout <<(a); #define sal(a) cout <<(a)<<endl; #define sak cout <<endl; #define dbg(a) cout <<(#a)<<": "<<(a)<<endl; #define a2l(a) ((ll)(a-97)) #define A2l(a) ((ll)(a-65)) #define l2a(a) ((char)(a+97)) #define l2A(a) ((char)(a+65)) #define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1)) #define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1)) #define Dig2(a,b) (((a)>>(b))&1) #define Dig10(a,b) (ll)(((a)/((ll)(pow(10.0,(double)(b)))))%10) #define Pow2(a) (1<<(a)) #define llin(a) ll (a);cin >>(a); #define stin(a) string (a);cin >>(a); #define rdn(a,b) ((a)/(b)) #define rou(a,b) ((((double(a)/double(b))-((a)/(b)))<0.5)?((a)/(b)):(((a)/(b))+1)) #define rup(a,b) ((((a)%(b))==0)?((a)/(b)):(((a)/(b))+1)) #define min(a,b) ((a<b)?(a):(b)) #define max(a,b) ((a>b)?(a):(b)) #define int ll const ll MOD = 1e9+7; const string alp = "abcdefghijklmnopqrstuvwxyz"; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);} ll lcm(ll a, ll b){return a/gcd(a,b)*b;} ll sgn(ll n){ if(n==0) return 0; else return n/abs(n); } ll salv(vll v){ say("{"); FOR(i,0,v.sz-1){ say(v[i]); if(i!=v.sz-1) say(","); } sal("}") } ll DigS10(ll n){ ll m=0; FOR(i,0,DigN10(n)-1){ m+=(ll)((llabs(n)%(ll)(pow(10.0,(double)(i+1))))/(ll)(pow(10.0,(double)i))); } return m; } ll isP(ll n){ if(n<=1) return 0; FOR(i,2,(ll)sqrt(n)){ if(n%i==0) return 0; } return 1; } vll FactM(1,1); vll FactMI(1,1); ll PowM(ll a,ll b){ ll ans=1,x=(a%MOD); FOR(i,0,DigN2(b)-1){ if(Dig2(b,i)==1) ans=(ans*x)%MOD; if(i!=(DigN2(b)-1)) x=(x*x)%MOD; } return ans; } void CFactM(ll n){ FOR(i,FactM.sz,n){ FactM.pb((FactM[i-1]*(i%MOD))%MOD); } return; } void CFactMI(ll n){ CFactM(n); if(FactMI.sz<(n+1)) FactMI.res(n+1,-1); if(FactMI[n]==-1) FactMI[n]=PowM(FactM[n],MOD-2); rFOR(i,1,n-1){ if(FactMI[i]!=-1) break; FactMI[i]=((FactMI[i+1]*((i+1)%MOD))%MOD); } return; } ll CombM(ll n,ll k){ if((n<0)||(k<0)) return 0; if(n<k) return 0; if(n+1>FactMI.sz) CFactMI(n); return ((((FactMI[k]*FactMI[n-k])%MOD)*FactM[n])%MOD); } ll signed main() { ll h,w,n,a[101],b[100][100]=0,x=0,y=0; cin >> h >> w >> n; REP1(i,n){ cin >> a[i]; } REP1(i,n){ REP(j,a[i]){ b[x][y] = i; if(y%2&&x==0){ y++; } else if (y%2==0&&x==w-1) { y++; } else if (y%2) { x--; } else if (y%2) { x++; } } REP(i,h){ REP(j,w){ cout << b[x][y] << " "; } cout << endl; } return 0; }
a.cc: In function 'll salv(vll)': a.cc:109:1: warning: no return statement in function returning non-void [-Wreturn-type] 109 | } | ^ a.cc: At global scope: a.cc:164:1: error: '::main' must return 'int' 164 | ll | ^~ a.cc: In function 'int main()': a.cc:167:31: error: array must be initialized with a brace-enclosed initializer 167 | ll h,w,n,a[101],b[100][100]=0,x=0,y=0; | ^ a.cc:192:2: error: expected '}' at end of input 192 | } | ^ a.cc:166:15: note: to match this '{' 166 | signed main() { | ^
s100229835
p03640
C++
#include <iostream> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int h, w, n; cin >> h >> w >> n; vector<int> a(n); for (auto& v : a) cin >> v; vector<vector<int>> grid(h, vector<int>(w)); int direction = 1; int index = 1; int x = 0, y = 0; for (auto to_paint : a) { for (int i = 0; i < to_paint; i++) { grid[x][y] = index; if ( (direction == 1 && y == w-1) || (direction == -1 && y == 0)) { x++; direction = -direction; } else y += direction; } index++; } for (auto& row : grid) { cout << row.front(); for_each(begin(row) + 1, end(row), [] (int color) { cout << ' ' << color; }); cout << endl; } }
a.cc: In function 'int main()': a.cc:31:17: error: 'for_each' was not declared in this scope 31 | for_each(begin(row) + 1, end(row), | ^~~~~~~~
s961814311
p03640
C++
/** SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ== */ #include <bits/stdc++.h> #define F first #define S second #define pb push_back const long long MOD = 1e9 + 7; const long long MAXN = 1e6 + 1; using namespace std; typedef long long ll; long long readInt() { bool minus1 = false; long long result = 0; char ch; ch = getchar(); while (true) { if (ch == '-') break; if (ch >= '0' && ch <= '9') break; ch = getchar(); } if (ch == '-') minus1 = true; else result = ch-'0'; while (true) { ch = getchar(); if (ch < '0' || ch > '9') break; result = result*10 + (ch - '0'); } if (minus1) return -result; else return result; } int a[MAXN]; int c[111][111]; void go(int i, int how) { if (how) { for (int j = 1; j <= W; j++) { c[i][j] = ptr; a[ptr]--; if (a[ptr] == 0) { ptr++; } } } else { for (int j = W; j >= 1; j--) { c[i][j] = ptr; a[ptr]--; if (a[ptr] == 0) { ptr++; } } } } int main() { int H = readInt(), W= readInt(); int n = readInt(); for (int i = 1; i <= n; i++) { a[i] = readInt(); } for (int i = 1; i <= n; i++) { go(i, i % 2); } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cout << c[i][j] << ' '; } cout << endl; } return 0; }
a.cc: In function 'void go(int, int)': a.cc:44:38: error: 'W' was not declared in this scope 44 | for (int j = 1; j <= W; j++) { | ^ a.cc:45:35: error: 'ptr' was not declared in this scope 45 | c[i][j] = ptr; | ^~~ a.cc:52:26: error: 'W' was not declared in this scope 52 | for (int j = W; j >= 1; j--) { | ^ a.cc:53:35: error: 'ptr' was not declared in this scope 53 | c[i][j] = ptr; | ^~~
s748573964
p03640
C++
#include "stdafx.h" #include <iostream> using namespace std; int main() { int rows, columns; cin >> rows >> columns; int **HW; HW = new int * [rows]; for (int i = 0; i < rows; i++) { HW[i] = new int[columns]; } for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { HW[i][j] = 0; } } //填格子开始 int Num; cin >> Num; int *a; a = new int[Num]; for (int i = 0; i < Num; i++) { cin >> a[i]; } int var = 0; int x = -1, y = 0; for (int i = 0; i < Num; i++) { for (int j = 0; j < a[i]; j++) { if (var == 0) { x++; if (x < columns && HW[y][x] == 0) { HW[y][x] = i + 1; } else { x--; j--; var++; } }else if (var == 1) { y++; if (y < rows && HW[y][x] == 0) { HW[y][x] = i + 1; } else { y--; j--; var++; } }else if (var == 2) { x--; if (x >= 0 && HW[y][x] == 0) { HW[y][x] = i + 1; } else { x++; j--; var++; } }else if(var == 3) { y--; if (y >= 0 && HW[y][x] == 0) { HW[y][x] = i + 1; } else { y++; j--; var = 0; } } } } //填格子结束 for (int i = 0; i < rows; i++) { cout << HW[i][0]; for (int j = 1; j < columns; j++) { cout << " " << HW[i][j]; } cout << endl; } return 0; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s808526073
p03640
C++
#include<iostream> using namespace std; int main() { int h = 0; int w = 0; int n = 0; int p[100][100]; while (cin >> h >> w >> n) { memset(p, 0, sizeof(p)); int *q = new int[n]; for (int i = 0; i < n; i++) { cin >> q[i]; } int i = 0, j = 0; int biaoji = 0;//0表示正向 for (int h1 = 0; h1 < n; h1++) { for (int g = 0; g < q[h1]; g++) { p[i][j] = q[h1]; if (biaoji == 0) { j++; } else { j--; } if (biaoji == 0 && j == w) { i++; j = w - 1; biaoji = 1; } else if (biaoji == 1 && j == -1) { biaoji = 0; i++; j = 0; } } } for (int h1 = 0; h1 < h; h1++) { for (int w1 = 0; w1 < w; w1++) { cout << p[h1][w1]; if (w1 != w - 1) { cout << " "; } else { cout << endl; } } } delete q; } return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: 'memset' was not declared in this scope 12 | memset(p, 0, sizeof(p)); | ^~~~~~ 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 | using namespace std;
s699436458
p03640
C++
#include <iostream> using namespace std; #define mems(a) (memset(a,0,sizeof(a))) int grid[102][102]; int height, width, sum, colors, counts; int main() { cin >> height >> width >> sum; mems(grid); counts = -1; for (int i = 1; i <= sum; i++) { cin>>colors; while (colors--) { counts++; grid[(counts / height) & 1 ? (height - 1 - (counts%height)) : counts % height][counts / height] = i; } } for (int i = 0; i<height; i++) { for (int j = 0; j<width; j++) { if (j!=0) cout<<" "; cout<<grid[i][j]; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:4:18: error: 'memset' was not declared in this scope 4 | #define mems(a) (memset(a,0,sizeof(a))) | ^~~~~~ a.cc:10:9: note: in expansion of macro 'mems' 10 | mems(grid); | ^~~~ 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 |
s104934251
p03640
C
#include<stdio.h> int main() { int H, W, N, i, j, x, y, n; int a[10000], b[10000] = { 0 }, HW[100][100] = {0}; while ((scanf("%d%d",&H,&W))==2) { scanf("%d", &N); for (i = 0,n=0; i < N; i++) { scanf("%d", &a[i]); sum += a[i]; for (j = 0; j < a[i]; j++) b[n++] = i+1; } n = 1; HW[x = 0][y = W - 1] = 1; while (b[n]) { while (x + 1 < H && !HW[x + 1][y]) HW[++x][y] = b[n++]; while (y - 1 >= 0 && !HW[x][y - 1]) HW[x][--y] = b[n++]; while (x - 1 >= 0 && !HW[x - 1][y]) HW[--x][y] = b[n++]; while (y + 1 < n && !HW[x][y + 1]) HW[x][++y] = b[n++]; } for (i = 0; i < H; i++) { for (j = 0; j < W; j++) { printf("%d ", HW[i][j]); } printf("\n"); } } return 0; }
main.c: In function 'main': main.c:12:25: error: 'sum' undeclared (first use in this function) 12 | sum += a[i]; | ^~~ main.c:12:25: note: each undeclared identifier is reported only once for each function it appears in
s320395031
p03640
Java
import java.io.*; import java.util.*; import java.text.*; public class Competition { public static void main(String[] args) { gridColoring(); } public static void sieve(int max) { boolean[] isComposite = new boolean[max+1]; for(int i=2; i<=max; i++) if(!isComposite[i]) for(int j=i*i; j<=max; j+=i) isComposite[j]=true; for(int i=2; i<=max; i++) if(!isComposite[i]) System.out.println(i + " "); } public static void gridColoring() { Reader reader = new Reader(); int height = reader.nextInt(); int width = reader.nextInt(); int num = reader.nextInt(); int[] colorNums = new int[num]; for(int j = 0; j < num; j++) colorNums[j] = reader.nextInt(); int[][] solution = new int[height][width]; int r = 0, c = 0, color = 1; for(int j = 0; j < height*width; j++) { r = j/width; c = (r%2 == 0)? j - j/width*width : width - (j - j/width*width) - 1; if(colorNums[color - 1] <= 0) color++; solution[r][c] = color; colorNums[color - 1]--; } for(int j = 0; j < height; j++) { for(int k = 0; k < width; k++) System.out.print(solution[j][k] + " "); System.out.println(); } } public static void simArrays() { Reader reader = new Reader(); int n = reader.nextInt(); int res = 1; res = exponential(3, n); int[] arr = new int[n]; for(int j = 0; j < n; j++) arr[j] = reader.nextInt(); int oddWays = 1; for(int j = 0; j < n; j++) if(arr[j] % 2 == 0) oddWays *= 2; System.out.println(res - oddWays); } public static int exponential(int base, int exp) { if(exp == 0) return 1; else if(exp % 2 == 0) return exponential((base*base), exp/2); return base*exponential((base*base), exp/2); //integer cutoff means (exp - 1)/2 unnecessary } } class Reader { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; String next() { while(st==null||!st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch(Exception e) {} } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } }
Main.java:5: error: class Competition is public, should be declared in a file named Competition.java public class Competition { ^ 1 error
s647155575
p03640
C++
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author verytable */ #include <iostream> #include <fstream> #include <iostream> #include <algorithm> static const std::string kSpaceChars = " \t\n\r\f\v"; inline std::string& rtrim(std::string& str, const std::string& chars = kSpaceChars) { str.erase(str.find_last_not_of(chars) + 1); return str; } inline std::string& ltrim(std::string& str, const std::string& chars = kSpaceChars) { str.erase(0, str.find_first_not_of(chars)); return str; } inline std::string& trim(std::string& str, const std::string& chars = kSpaceChars) { return ltrim(rtrim(str, chars), chars); } class TaskD { public: void solve(std::istream &in, std::ostream &out) { int h, w; in >> h >> w; int n; in >> n; std::vector<int> row_paint; int row = 0; int col = 0; for (int i = 0; i < n; ++i) { int a; in >> a; while (a > 0) { bool left_to_right = (row % 2 == 0); if (left_to_right) { int to_paint = std::min(a, w - col); col += to_paint; a -= to_paint; for (int j = 0; j < to_paint; ++j) { row_paint.push_back(i + 1); } if (col == w) { ++row; std::string row_paint_str; for (auto c: row_paint) { row_paint_str += std::to_string(c) + " "; } trim(row_paint_str); out << row_paint_str << '\n'; row_paint.clear(); } } else { int to_paint = std::min(a, col); col -= to_paint; a -= to_paint; for (int j = 0; j < to_paint; ++j) { row_paint.push_back(i + 1); } if (col == 0) { ++row; std::reverse(row_paint.begin(), row_paint.end()); std::string row_paint_str; for (auto c: row_paint) { row_paint_str += std::to_string(c) + " "; } trim(row_paint_str); out << row_paint_str << '\n'; row_paint.clear(); } } } } } }; int main() { TaskD solver; std::istream &in(std::cin); std::ostream &out(std::cout); solver.solve(in, out); return 0; }
a.cc: In member function 'void TaskD::solve(std::istream&, std::ostream&)': a.cc:39:14: error: 'vector' is not a member of 'std' 39 | std::vector<int> row_paint; | ^~~~~~ a.cc:12:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 11 | #include <algorithm> +++ |+#include <vector> 12 | a.cc:39:21: error: expected primary-expression before 'int' 39 | std::vector<int> row_paint; | ^~~ a.cc:56:25: error: 'row_paint' was not declared in this scope; did you mean 'to_paint'? 56 | row_paint.push_back(i + 1); | ^~~~~~~~~ | to_paint a.cc:62:38: error: 'row_paint' was not declared in this scope; did you mean 'to_paint'? 62 | for (auto c: row_paint) { | ^~~~~~~~~ | to_paint a.cc:67:25: error: 'row_paint' was not declared in this scope; did you mean 'to_paint'? 67 | row_paint.clear(); | ^~~~~~~~~ | to_paint a.cc:76:25: error: 'row_paint' was not declared in this scope; did you mean 'to_paint'? 76 | row_paint.push_back(i + 1); | ^~~~~~~~~ | to_paint a.cc:81:38: error: 'row_paint' was not declared in this scope; did you mean 'to_paint'? 81 | std::reverse(row_paint.begin(), row_paint.end()); | ^~~~~~~~~ | to_paint
s409219910
p03640
C++
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author verytable */ #include <iostream> #include <fstream> #include <iostream> #include <algorithm> #include "../library/util.h" class TaskD { public: void solve(std::istream &in, std::ostream &out) { int h, w; in >> h >> w; int n; in >> n; std::string row_paint; int row = 0; int col = 0; for (int i = 0; i < n; ++i) { int a; in >> a; while (a > 0) { bool left_to_right = (row % 2 == 0); if (left_to_right) { int to_paint = std::min(a, w - col); col += to_paint; a -= to_paint; for (int j = 0; j < to_paint; ++j) { row_paint += std::to_string(i + 1) + ' '; } if (col == w) { ++row; trim(row_paint); out << row_paint << '\n'; row_paint = ""; } } else { int to_paint = std::min(a, col); col -= to_paint; a -= to_paint; for (int j = 0; j < to_paint; ++j) { row_paint += std::to_string(i + 1) + ' '; } if (col == 0) { ++row; std::reverse(row_paint.begin(), row_paint.end()); trim(row_paint); out << row_paint << '\n'; row_paint = ""; } } } } } }; int main() { TaskD solver; std::istream &in(std::cin); std::ostream &out(std::cout); solver.solve(in, out); return 0; }
a.cc:12:10: fatal error: ../library/util.h: No such file or directory 12 | #include "../library/util.h" | ^~~~~~~~~~~~~~~~~~~ compilation terminated.
s033574096
p03640
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <stack> #include <sstream> using namespace std; string to_string(int i){ stringstream ss; ss << i; return ss.str(); } int main(){ int H, W; int N; cin >> H >> W >> N; string outstr[H]; int c = 0; int r = 0; for(int i=0;i<N;++i){ int p; cin >> p; while(p>0){ //cout<<"inp,"<<W<<","<<r<<","<<p<<endl; int wnum = min(W-r,p); //幾つ書き込むか if(c%2==0){ for(int j=0;j<wnum;++j){ outstr[c] += to_string(i+1); if(r+j != W-1){ outstr[c] += " "; // 一番最後にスペースを入れない } } }else{ for(int j=0;j<wnum;++j){ if(r!=0){ outstr[c] = to_string(i+1)+" " + outstr[c]; }else{ outstr[c] = to_string(i+1); } } } r+=wnum; p-=wnum; //cout<<wnum<<","<<c<<","<<r<<","<<p<<endl; if(r==W){ c++; r=0; } } } for(int i=0;i<H;++i){ cout<<outstr[i]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:31:33: error: call of overloaded 'to_string(int)' is ambiguous 31 | outstr[c] += to_string(i+1); | ~~~~~~~~~^~~~~ a.cc:10:8: note: candidate: 'std::string to_string(int)' 10 | string to_string(int i){ | ^~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:4240:3: note: candidate: 'std::string std::__cxx11::to_string(int)' 4240 | to_string(int __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4259:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)' 4259 | to_string(unsigned __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4275:3: note: candidate: 'std::string std::__cxx11::to_string(long int)' 4275 | to_string(long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4294:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)' 4294 | to_string(unsigned long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4310:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)' 4310 | to_string(long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4327:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)' 4327 | to_string(unsigned long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4401:3: note: candidate: 'std::string std::__cxx11::to_string(float)' 4401 | to_string(float __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4411:3: note: candidate: 'std::string std::__cxx11::to_string(double)' 4411 | to_string(double __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4421:3: note: candidate: 'std::string std::__cxx11::to_string(long double)' 4421 | to_string(long double __val) | ^~~~~~~~~ a.cc:39:34: error: call of overloaded 'to_string(int)' is ambiguous 39 | outstr[c] = to_string(i+1)+" " + outstr[c]; | ~~~~~~~~~^~~~~ a.cc:10:8: note: candidate: 'std::string to_string(int)' 10 | string to_string(int i){ | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4240:3: note: candidate: 'std::string std::__cxx11::to_string(int)' 4240 | to_string(int __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4259:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)' 4259 | to_string(unsigned __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4275:3: note: candidate: 'std::string std::__cxx11::to_string(long int)' 4275 | to_string(long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4294:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)' 4294 | to_string(unsigned long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4310:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)' 4310 | to_string(long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4327:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)' 4327 | to_string(unsigned long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4401:3: note: candidate: 'std::string std::__cxx11::to_string(float)' 4401 | to_string(float __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4411:3: note: candidate: 'std::string std::__cxx11::to_string(double)' 4411 | to_string(double __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4421:3: note: candidate: 'std::string std::__cxx11::to_string(long double)' 4421 | to_string(long double __val) | ^~~~~~~~~ a.cc:41:34: error: call of overloaded 'to_string(int)' is ambiguous 41 | outstr[c] = to_string(i+1); | ~~~~~~~~~^~~~~ a.cc:10:8: note: candidate: 'std::string to_string(int)' 10 | string to_string(int i){ | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4240:3: note: candidate: 'std::string std::__cxx11::to_string(int)' 4240 | to_string(int __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4259:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)' 4259 | to_string(unsigned __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4275:3: note: candidate: 'std::string std::__cxx11::to_string(long int)' 4275 | to_string(long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4294:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)' 4294 | to_string(unsigned long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4310:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)' 4310 | to_string(long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4327:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)' 4327 | to_string(unsigned long long __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4401:3: note: candidate: 'std::string std::__cxx11::to_string(float)' 4401 | to_string(float __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4411:3: note: candidate: 'std::string std::__cxx11::to_string(double)' 4411 | to_string(double __val) | ^~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4421:3: note: candidate: 'std::string std::__cxx11::to_string(long double)' 4421 | to_string(long double __val) | ^~~~~~~~~
s901445427
p03640
C++
#include <iostream> #include <algorithm> #include <string.h> #include <math.h> #include <queue> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define ull unsigned ll #define db double #define INF 0x3f3f3f3f #define MOD 1000000007 #define PII pair<int, int> int h,w; int n; int a; int grid[105][105]; int main() { scanf("%d%d%d",&h,&w,&n); queue<int> q; for (int i=1;i<=n;i++) { scanf("%d",a); for (int j=0;j<a;j++) q.pb(i); } for (int i=1;i<=h;i++) { if (i%2==1) { for (int j=1;j<=w;j++) { grid[i][j]=q.front();q.pop(); } } else { for (int j=w;j>=1;j--) { grid[i][j]=q.front();q.pop(); } } } for (int i=1;i<=h;i++) { for (int j=1;j<=w;j++) { printf("%d ",grid[i][j]); } printf("\n"); } }
a.cc: In function 'int main()': a.cc:10:12: error: 'class std::queue<int>' has no member named 'push_back' 10 | #define pb push_back | ^~~~~~~~~ a.cc:30:33: note: in expansion of macro 'pb' 30 | for (int j=0;j<a;j++) q.pb(i); | ^~
s881252026
p03640
C++
using u32 = unsigned int; using u64 = unsigned long long int; using str = string; template <typename T> using vec = vector<T>; void in() { } template <typename T, typename...TS> void in(T &&x, TS &&...xs) { cin >> x; in(move(xs)...); } template <typename T> void out(T &&x) { cout << x << "\n"; } template <typename T, typename...TS> void out(T &&x, TS &&...xs) { cout << x << " "; out(move(xs)...); } #define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__) #define get(t) []{ t x; cin >> x; return x; }() #define times(n, i) for (i32 i = 0; i < (n); ++i) #define range(a, b, i) for (i32 i = (a); i < (b); ++i) #define upto(a, b, i) for (i32 i = (a); i <= (b); ++i) #define downto(a, b, i) for (i32 i = (a); i >= (b); --i) #define all(xs) (xs).begin(), (xs).end() #define sortall(xs) sort(all(xs)) #define reverseall(xs) reverse(all(xs)) #define even(x) ((abs(x) & 1) == 0) #define odd(x) ((abs(x) & 1) == 1) #define bit(x, i) (((x) >> i) & 1) #define append emplace_back #define bisect_left lower_bound #define bisect_right upper_bound #define bound(a, x, b) (a <= x && x <= b) const i64 MOD = 1000000007ll; const f64 EPS = 1e-10; i32 ans[100][100]; void solve() { indef(i32, h, w); indef(i32, n); queue<i32> a; times(n, i){ a.push(get(i32)); } i32 t = 0, c = 0; times(h, i) { times(w, j) { i32 jj = even(i) ? j : w-j-1; if (t == 0) { t += a.front(); a.pop(); c++; } t--; ans[i][jj] = c; } } times(h, i) { times(w-1, j) { cout << ans[i][j] << " "; } cout << ans[i][w-1] << endl; } } i32 main() { ios::sync_with_stdio(false); #ifdef _MSC_VER /** ifstream fin("input.txt"); cin.rdbuf(fin.rdbuf()); assert(fin); ofstream fout("output.txt"); cout.rdbuf(fout.rdbuf()); assert(fout); /**/ #endif //cout << fixed << setprecision(9); solve(); return 0; }
a.cc:1:75: error: 'string' does not name a type 1 | using u32 = unsigned int; using u64 = unsigned long long int; using str = string; | ^~~~~~ a.cc:2:35: error: 'vector' does not name a type 2 | template <typename T> using vec = vector<T>; void in() { } | ^~~~~~ a.cc: In function 'void in(T&&, TS&& ...)': a.cc:3:67: error: 'cin' was not declared in this scope; did you mean 'in'? 3 | template <typename T, typename...TS> void in(T &&x, TS &&...xs) { cin >> x; in(move(xs)...); } | ^~~ | in a.cc: In function 'void out(T&&)': a.cc:4:41: error: 'cout' was not declared in this scope; did you mean 'out'? 4 | template <typename T> void out(T &&x) { cout << x << "\n"; } | ^~~~ | out a.cc: In function 'void out(T&&, TS&& ...)': a.cc:5:68: error: 'cout' was not declared in this scope; did you mean 'out'? 5 | template <typename T, typename...TS> void out(T &&x, TS &&...xs) { cout << x << " "; out(move(xs)...); } | ^~~~ | out a.cc: At global scope: a.cc:22:7: error: 'i64' does not name a type; did you mean 'u64'? 22 | const i64 MOD = 1000000007ll; | ^~~ | u64 a.cc:23:7: error: 'f64' does not name a type; did you mean 'u64'? 23 | const f64 EPS = 1e-10; | ^~~ | u64 a.cc:25:1: error: 'i32' does not name a type; did you mean 'u32'? 25 | i32 ans[100][100]; | ^~~ | u32 a.cc: In function 'void solve()': a.cc:28:11: error: 'i32' was not declared in this scope; did you mean 'u32'? 28 | indef(i32, h, w); | ^~~ a.cc:6:23: note: in definition of macro 'indef' 6 | #define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__) | ^ a.cc:28:16: error: 'h' was not declared in this scope 28 | indef(i32, h, w); | ^ a.cc:6:41: note: in definition of macro 'indef' 6 | #define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__) | ^~~~~~~~~~~ a.cc:28:19: error: 'w' was not declared in this scope 28 | indef(i32, h, w); | ^ a.cc:6:41: note: in definition of macro 'indef' 6 | #define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__) | ^~~~~~~~~~~ a.cc:29:16: error: expected ';' before 'n' 29 | indef(i32, n); | ^ a.cc:6:25: note: in definition of macro 'indef' 6 | #define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__) | ^~~~~~~~~~~ a.cc:29:16: error: 'n' was not declared in this scope; did you mean 'in'? 29 | indef(i32, n); | ^ a.cc:6:41: note: in definition of macro 'indef' 6 | #define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__) | ^~~~~~~~~~~ a.cc:30:5: error: 'queue' was not declared in this scope 30 | queue<i32> a; | ^~~~~ a.cc:30:16: error: 'a' was not declared in this scope 30 | queue<i32> a; | ^ a.cc:31:14: error: expected ';' before 'i' 31 | times(n, i){ | ^ a.cc:8:30: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:31:14: error: 'i' was not declared in this scope; did you mean 'in'? 31 | times(n, i){ | ^ a.cc:8:37: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc: In lambda function: a.cc:32:20: error: 'i32' is not captured 32 | a.push(get(i32)); | ^~~ a.cc:7:20: note: in definition of macro 'get' 7 | #define get(t) []{ t x; cin >> x; return x; }() | ^ a.cc:7:17: note: the lambda has no capture-default 7 | #define get(t) []{ t x; cin >> x; return x; }() | ^ a.cc:32:16: note: in expansion of macro 'get' 32 | a.push(get(i32)); | ^~~ a.cc:28:11: note: '<typeprefixerror>i32' declared here 28 | indef(i32, h, w); | ^~~ a.cc:6:23: note: in definition of macro 'indef' 6 | #define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__) | ^ a.cc:7:25: error: 'cin' was not declared in this scope; did you mean 'in'? 7 | #define get(t) []{ t x; cin >> x; return x; }() | ^~~ a.cc:32:16: note: in expansion of macro 'get' 32 | a.push(get(i32)); | ^~~ a.cc:7:32: error: 'x' was not declared in this scope 7 | #define get(t) []{ t x; cin >> x; return x; }() | ^ a.cc:32:16: note: in expansion of macro 'get' 32 | a.push(get(i32)); | ^~~ a.cc: In function 'void solve()': a.cc:34:8: error: expected ';' before 't' 34 | i32 t = 0, c = 0; | ^~ | ; a.cc:35:14: error: expected ';' before 'i' 35 | times(h, i) { | ^ a.cc:8:30: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:35:14: error: 'i' was not declared in this scope; did you mean 'in'? 35 | times(h, i) { | ^ a.cc:8:37: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:36:18: error: expected ';' before 'j' 36 | times(w, j) { | ^ a.cc:8:30: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:36:18: error: 'j' was not declared in this scope 36 | times(w, j) { | ^ a.cc:8:37: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:37:16: error: expected ';' before 'jj' 37 | i32 jj = even(i) ? j : w-j-1; | ^~~ | ; a.cc:38:17: error: 't' was not declared in this scope 38 | if (t == 0) { | ^ a.cc:41:17: error: 'c' was not declared in this scope 41 | c++; | ^ a.cc:43:13: error: 't' was not declared in this scope 43 | t--; | ^ a.cc:44:13: error: 'ans' was not declared in this scope 44 | ans[i][jj] = c; | ^~~ a.cc:44:20: error: 'jj' was not declared in this scope 44 | ans[i][jj] = c; | ^~ a.cc:44:26: error: 'c' was not declared in this scope 44 | ans[i][jj] = c; | ^ a.cc:47:14: error: expected ';' before 'i' 47 | times(h, i) { | ^ a.cc:8:30: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:47:14: error: 'i' was not declared in this scope; did you mean 'in'? 47 | times(h, i) { | ^ a.cc:8:37: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:48:20: error: expected ';' before 'j' 48 | times(w-1, j) { | ^ a.cc:8:30: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:48:20: error: 'j' was not declared in this scope 48 | times(w-1, j) { | ^ a.cc:8:37: note: in definition of macro 'times' 8 | #define times(n, i) for (i32 i = 0; i < (n); ++i) | ^ a.cc:49:13: error: 'cout' was not declared in this scope; did you mean 'out'? 49 | cout << ans[i][j] << " "; | ^~~~ | out a.cc:49:21: error: 'ans' was not declared in this scope 49 | cout << ans[i][j] << " "; | ^~~ a.cc:51:9: error: 'cout' was not declared in this scope; did you mean 'out'? 51 | cout << ans[i][w-1] << endl; | ^~~~ | out a.cc:51:17: error: 'ans' was not declared in this scope 51 | cout << ans[i][w-1] << endl; | ^~~ a.cc:51:32: error: 'endl' was not declared in this scope 51 | cout << ans[i][w-1] << endl; | ^~~~ a.cc: At global scope: a.cc:55:1: error: 'i32' does not name a type; did you mean 'u32'? 55 | i32 main() | ^~~ | u32
s471194779
p03640
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int h, w; cin >> h >> w; int n; cin >> n; vector<int> vs; for (int i = 1; i <= n; i++) { int v; cin >> v; for (int j = 0; j < v; j++) { vs.push_back(i); } } for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { int index = (j % 2 == 0 ? j * w + i : j * w + (w - 1 - i)); if (i > 0) cout << " "; cout << vs[index]; } cout << endl; } }
a.cc: In function 'int main()': a.cc:12:3: error: 'vector' was not declared in this scope 12 | vector<int> vs; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <algorithm> +++ |+#include <vector> 3 | a.cc:12:10: error: expected primary-expression before 'int' 12 | vector<int> vs; | ^~~ a.cc:19:11: error: 'vs' was not declared in this scope; did you mean 'v'? 19 | vs.push_back(i); | ^~ | v a.cc:28:19: error: 'vs' was not declared in this scope 28 | cout << vs[index]; | ^~
s582036815
p03640
C
#include <iostream> #include <vector> #include <cmath> #include <algorithm> using namespace std; void print_front(vector<int>& line) { bool first = true; for (int i = 0; i < line.size(); i++) { if (!first) { cout << " "; } cout << line[i]; first = false; } cout << endl; } void print_back(vector<int>& line) { bool first = true; for (int i = line.size() - 1; i >= 0; i--) { if (!first) { cout << " "; } cout << line[i]; first = false; } cout << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); int h, w, n; cin >> h >> w >> n; vector<int> a(n); for (auto& e : a) { cin >> e; } vector<int> line; bool odd = true; for (int i = 0; i < a.size(); i++) { for (int j = 0; j < a[i]; j++) { line.push_back(i+1); if (line.size() == w) { if (odd) { print_front(line); } else { print_back(line); } line.clear(); odd = !odd; } } } return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s960947970
p03640
C
#include <cstdio> using namespace std; int h, w, n, a[1100], mp[1100][1100], cnt = 0, now = 1; int main() { scanf("%d%d%d", &h, &w, &n); for(int i = 1; i <= n; i++) { scanf("%d", &a[i]); } for(int i = 1; i <= h; i++) { int from = (i & 1) ? 1 : w; int to = (i & 1) ? w + 1 : 0; int delta = (i & 1) ? 1 : -1; for(int j = from; j != to; j += delta) { mp[i][j] = now; cnt++; if(a[now] == cnt) { now++; cnt = 0; } } } for(int i = 1; i <= h; i++) { for(int j = 1; j < w; j++) { printf("%d ", mp[i][j]); } printf("%d\n", mp[i][w]); } return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s391699983
p03640
C
#include <bits/stdc++.h> using namespace std; int h, w, n, a[1100], mp[1100][1100], cnt = 0, now = 1; int main() { scanf("%d%d%d", &h, &w, &n); for(int i = 1; i <= n; i++) { scanf("%d", &a[i]); } for(int i = 1; i <= h; i++) { int from = (i & 1) ? 1 : w; int to = (i & 1) ? w + 1 : 0; int delta = (i & 1) ? 1 : -1; for(int j = from; j != to; j += delta) { mp[i][j] = now; cnt++; if(a[now] == cnt) { now++; cnt = 0; } } } for(int i = 1; i <= h; i++) { for(int j = 1; j < w; j++) { printf("%d ", mp[i][j]); } printf("%d\n", mp[i][w]); } return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s622953963
p03640
C++
#include <cstdio> int c[2000][2000]; int main() { int n, m, k; int x = 0, y = 0; scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < k; ++i); int a; scanf("%d", &a); while (a--) { c[x][y] = i + 1; if (~x & 1) y < m - 1 ? ++y : ++x; else y > 0 ? --y : ++x; } } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) printf("%d ", c[i][j]); printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:11:21: error: 'i' was not declared in this scope 11 | c[x][y] = i + 1; | ^ a.cc: At global scope: a.cc:16:7: error: expected unqualified-id before 'for' 16 | for (int i = 0; i < n; ++i) { | ^~~ a.cc:16:23: error: 'i' does not name a type 16 | for (int i = 0; i < n; ++i) { | ^ a.cc:16:30: error: expected unqualified-id before '++' token 16 | for (int i = 0; i < n; ++i) { | ^~ a.cc:21:7: error: expected unqualified-id before 'return' 21 | return 0; | ^~~~~~ a.cc:22:5: error: expected declaration before '}' token 22 | } | ^
s512993476
p03640
C++
#include <cstdio> int c[2000][2000]; int main() { int n, m, k; int x = 0, y = 0; scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < k; ++i); int a; scanf("%d", &a); while (a--) { c[x][y] = i + 1; if (~x & 1) y < m - 1 ? ++y : ++x; else y > 0 ? --y : ++x; } } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) printf("%d ", c[i][j]); printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: 'i' was not declared in this scope 11 | c[x][y] = i + 1; | ^ a.cc: At global scope: a.cc:16:3: error: expected unqualified-id before 'for' 16 | for (int i = 0; i < n; ++i) { | ^~~ a.cc:16:19: error: 'i' does not name a type 16 | for (int i = 0; i < n; ++i) { | ^ a.cc:16:26: error: expected unqualified-id before '++' token 16 | for (int i = 0; i < n; ++i) { | ^~ a.cc:21:3: error: expected unqualified-id before 'return' 21 | return 0; | ^~~~~~ a.cc:22:1: error: expected declaration before '}' token 22 | } | ^
s977837870
p03640
C++
#include <bits/stdc++.h> using namespace std; #define ll long long const ll MOD = 1e9 + 7; #define all(x) (x).begin(), (x).end() #define UN(a) sort(all(a)), a.erase(unique(all(a)), a.end()) int n, m, N; int mp[110][110]; bool vis[110][110]; int a[10010]; int dx[4] = {0, 0, 1, -1}; int dy[4] = {1, -1, 0, 0}; bool go(int x, int y){ return x >= 0 && x < n && y >= 0 && y < m; } int index, num, cur, step; void dfs(int i, int j){ vis[i][j] = 1; mp[i][j] = cur; num--; step++; if(!num && index == N - 1){ // cout<<i<<"aaaaaaaaaaaa"<<j<<endl; return; } if(num == 0){ index ++; cur ++; num = a[index]; } for(int k = 0; k < 4; ++k){ int nx = i + dx[k]; int ny = j + dy[k]; if(!vis[nx][ny] && go(nx, ny)){ dfs(nx, ny); // num--; // if(num == 0){ // index ++; // cur ++; // num = a[index]; // } // if(index == N - 1 && num == 0)return; } } return; } int main(){ cin >> n>>m; cin >> N; for(int i = 0; i < N; ++i){ cin >> a[i]; } index = 0; cur = 1; num = a[index], step = 0; dfs(0, 0); for(int i = 0; i < n; ++i){ for(int j = 0; j < m; ++j){ cout << mp[i][j] << " "; } cout << endl; } return 0; } //const int maxn = 1050; //ll v[11][maxn]; //ll c[maxn], w[maxn]; //ll f[11][maxn]; // //const ll inf = 12345126789123; //int main() { // freopen("input.txt", "r", stdin); // ios_base::sync_with_stdio(0); // int n, m; // ll a, b; // int T; // cin >> T; // while(T--){ // cin >> m >> n; // memset(v, 0, sizeof(v)); // ll mb = inf; // for(int i = 1; i <= n; ++i){ // cin>>c[i]>>w[i]; // } // // for(int i = 0; i < 11; ++i)for(int j = 0; j < maxn; ++j)f[i][j] = inf; // for(int k = 0; k < 11; ++k){ // for(int i=1;i<=m;i++){ // f[k][0] = 0; // for(int j=maxn;j<maxn;j++){ // if(w[i] >= k){ // f[k][j]=min(f[k][j],f[k][j-w[i]+k]+c[i]); // } // } // } // } // if(res >= inf)cout << -1 << endl; // else // cout <<res<<endl; // } // return 0; //}
a.cc:19:5: error: 'int index' redeclared as different kind of entity 19 | int index, num, cur, step; | ^~~~~ 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 'void dfs(int, int)': a.cc:25:22: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator==' 25 | if(!num && index == N - 1){ | ~~~~~~^~~~~~~~ a.cc:30:15: error: no post-increment operator for type 30 | index ++; | ^~ a.cc:32:16: error: invalid types 'int [10010][<unresolved overloaded function type>]' for array subscript 32 | num = a[index]; | ^ a.cc: In function 'int main()': a.cc:56:13: error: overloaded function with no contextual type information 56 | index = 0; cur = 1; num = a[index], step = 0; | ^ a.cc:56:32: error: invalid types 'int [10010][<unresolved overloaded function type>]' for array subscript 56 | index = 0; cur = 1; num = a[index], step = 0; | ^
s112310831
p03640
C++
#include <bits/stdc++.h> #define for0(i, n) for(int i = 0; i < n; i++) #define for1(i, n) for(int i = 1; i <= n; i++) #define pb push_back #define mp make_pair #define all(v) v.begin(), v.end() #define V vector<int> #define VP vector<pair<int, int> > #define FASTIO ios_base::sync_with_stdio(0); cin.tie(0) using namespace std; #ifdef _WIN32 #include <windows.h> #define print(x) PRINT(x, #x) template<typename T> inline const void PRINT(T VARIABLE, string NAME) { #ifndef ONLINE_JUDGE /// ONLINE_JUDGE IS DEFINED ON CODEFORCES HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, 10); cerr << NAME << " = " << VARIABLE << '\n'; SetConsoleTextAttribute(hConsole, 7); #endif } #else #define print(x) 0 #endif struct pair_hash { template<typename T1, typename T2> size_t operator () (const pair<T1, T2> &p) const { auto h1 = hash<T1> {}(p.first); auto h2 = hash<T2> {}(p.second); return h1 ^ h2; } }; typedef long long ll; typedef unsigned long long ull; const ll INFLL = 2 * (ll)1e18 + 100; const int INFINT = 2 * (int)1e9 + 100; //ifstream fin(".in"); //ofstream fout(".out"); void die() { cout << "NO"; exit(0); } const int NMAX = 2 * 1e5 + 5; const int MOD = 1e9 + 7; /// careful here (7 or 9, 66.. etc) const double PI = atan(1) * 4; const double EPS = 1e-12; int h, w, n; int v[NMAX]; pair<int, int> cur; bool dir; int sol[105][105]; int index = 1; int main() { FASTIO; cin >> h >> w >> n; for1(i, n) cin >> v[i]; cur = mp(1, 1); while(v[n]) { if(v[index] == 0) index++; sol[cur.first][cur.second] = index; print(cur.first); print(cur.second); print("\n"); v[index]--; if(dir == 0) { cur.second++; if(cur.second == w + 1) { cur.second = w; dir = 1; cur.first++; } } else { cur.second--; if(cur.second == 0) { cur.second = 1; dir = 0; cur.first++; } } } for1(i, h) for1(j, w) cout << sol[i][j] << " \n"[j == w]; return 0; }
a.cc:57:5: error: 'int index' redeclared as different kind of entity 57 | int index = 1; | ^~~~~ 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:67:13: error: invalid types 'int [200005][<unresolved overloaded function type>]' for array subscript 67 | if(v[index] == 0) index++; | ^ a.cc:67:32: error: no post-increment operator for type 67 | if(v[index] == 0) index++; | ^~ a.cc:68:38: error: cannot resolve overloaded function 'index' based on conversion to type 'int' 68 | sol[cur.first][cur.second] = index; | ^~~~~ a.cc:72:10: error: invalid types 'int [200005][<unresolved overloaded function type>]' for array subscript 72 | v[index]--; | ^
s713529137
p03640
C++
#include <assert.h> #include <ctype.h> #include <errno.h> #include <float.h> #include <fstream> #include <iomanip> #include <iostream> #include <limits> #include <locale> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <wchar.h> #include <wctype.h> #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <exception> #include <functional> #include <map> #include <ios> #include <iosfwd> #include <istream> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <utility> #include <vector> #include <cwchar> #include <cwctype> #include <complex.h> #include <fenv.h> #include <inttypes.h> #include <stdbool.h> #include <stdint.h> #include <tgmath.h> #include <conio.h> #include <numeric> #include <list> #include <windows.h> #include <cfloat> #include <climits> #include <unordered_map> #include <unordered_set> using namespace std; int n,m,k,num[10010],mp[110][110],x,y; inline void solve(int c,bool dic) { if(num[c]) { mp[x][y]=c; num[c]--; if(dic==0&&y==m-1) x++,solve(c,1); else if(dic==1&&y==0) x++,solve(c,0); else if(dic==0) y++,solve(c,0); else y--,solve(c,1); } } int main() { cin>>n>>m>>k; for(int i=1;i<=k;i++) cin>>num[i]; for(int i=1;i<=k;i++) if(y==m-1||mp[x][y+1]) solve(i,1); else solve(i,0); for(int i=0;i<n;i++) { for(int j=0;j<m;j++) cout<<mp[i][j]<<' '; cout<<endl; } return 0; }
a.cc:53:10: fatal error: conio.h: No such file or directory 53 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s740710142
p03640
C++
#include <iostream> using namespace std;   const int MAXN = 1e2 + 10; int gel[MAXN][MAXN]; int a[MAXN * MAXN];   int main(void){ int h, w, n; cin >> h >> w >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } int cnt1 = 0, indx = 1; for(int i = 0; i < h; i++){ if(i % 2 == 0){ for(int j = 0; j < w; j++){ gel[i][j] = indx; a[indx]--; if(a[indx] <= 0) indx++; } }else{ for(int j = w - 1; j >= 0; j--){ gel[i][j] = indx; a[indx]--; if(a[indx] <= 0) indx++; } } } for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ cout << gel[i][j] << " "; } cout << endl; } return 0; }
a.cc:3:1: error: extended character   is not valid in an identifier 3 |   | ^ a.cc:7:1: error: extended character   is not valid in an identifier 7 |   | ^ a.cc:3:1: error: '\U000000a0' does not name a type 3 |   | ^ a.cc:5:9: error: 'MAXN' was not declared in this scope 5 | int gel[MAXN][MAXN]; | ^~~~ a.cc:5:15: error: 'MAXN' was not declared in this scope 5 | int gel[MAXN][MAXN]; | ^~~~ a.cc:6:7: error: 'MAXN' was not declared in this scope 6 | int a[MAXN * MAXN]; | ^~~~ a.cc:6:14: error: 'MAXN' was not declared in this scope 6 | int a[MAXN * MAXN]; | ^~~~ a.cc:7:1: error: '\U000000a0' does not name a type 7 |   | ^