submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s694719782
p03680
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; int a[100010]; for(int i = 0; i < n; ++i) cin >> a[i]; int counter = 1; while(a[i] != 2) { int i = 0; if(a[i] == 1) { counter = -1; break; } i = a[i] - 1;...
a.cc: In function 'int main()': a.cc:11:13: error: 'i' was not declared in this scope 11 | while(a[i] != 2) { | ^
s903686049
p03680
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,s; cin >> N; vector<int> button(N+1,0); button.at(0) = 1; for(int i=0;i<N;i++){ cin >> s; if(button.at(i) == 1){ button.at(i) = 0; button.at(s-1) = 1; button.at(N)++; } if(button.at(1) == 1){ cou...
a.cc: In function 'int main()': a.cc:28:2: error: expected '}' at end of input 28 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s572404710
p03680
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,s,result=0; cin >> N; vector<int> button(N,0); button.at(0) = 1; for(int i=0;i<N;i++){ cin >> s; if(button.at(i) == 1){ button.at(i) = 0; button.at(s-1) = 1; result++; } } if(button.at(1) == 1){ ...
a.cc: In function 'int main()': a.cc:23:7: error: break statement not within loop or switch 23 | break; | ^~~~~
s380078905
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); for (int i=0; i<N; ++i) { cin >> vec.at(i); } int i=0; while (int a != 2) { a = vec.at(a); ++i; if (i>N) { break; } } if (i <= N-1) { cout << i << endl; }else{ cout << -1 ...
a.cc: In function 'int main()': a.cc:12:16: error: expected initializer before '!=' token 12 | while (int a != 2) { | ^~ a.cc:12:15: error: expected ')' before '!=' token 12 | while (int a != 2) { | ~ ^~~ | ) a.cc:12:16: error: expected primary-expres...
s998215561
p03680
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin>>n; int a[n]; for (int i=0;i<n;i++) { cin>>a[i]; a[i]--; } int vis[n]{}; int p=0; int cnt=0; while (1) { if (vis[i]) { cout<<-1<<endl; return 0...
a.cc: In function 'int main()': a.cc:17:17: error: 'i' was not declared in this scope 17 | if (vis[i]) { | ^
s020711670
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,now,ans; ans=0; cin >> n; vector<int> bot(n); for(int i=0;i<n;i++){ cin>>(bot[i]-1); } for(;;){ if(now==1){ break; } if(ans>n){ ans=-1; break; } ans++; now=bot...
a.cc: In function 'int main()': a.cc:10:10: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 10 | cin>>(bot[i]-1); | ~~~^~~~~~~~~~~~ | | | ...
s408992559
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,now,ans; ans=0; cin >> n; vector<int> bot(n); for(int i=0;i<n;i++){ cin>>bot[i]-1; } for(;;){ if(now==1){ break; } if(ans>n){ ans=-1; break; } ans++; now=bot[n...
a.cc: In function 'int main()': a.cc:10:10: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 10 | cin>>bot[i]-1; | ~~~^~ | | | std::istream {...
s082873838
p03680
C++
#include <iostream> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } int j = 1; int count = 0; for (int i = 0; i < N; i++) { j = a.at(j - 1); ...
a.cc: In function 'int main()': a.cc:11:5: error: 'vector' was not declared in this scope 11 | vector<int> a(N); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <iostream> +++ |+#include <vector> 2 | u...
s352336409
p03680
C++
#include <iostream> #include <vector> using namespace std; int visit(int cnt, int idx, vector<int> &a, vector<bool> &v){ if(cnt >= N) return -1; else if(v[a[idx]]) return -1; else if(a[idx] == 2) return cnt; else{ v[idx] = true; return visit(cnt + 1, a[idx], a, v); } } int main(void) { int N; ...
a.cc: In function 'int visit(int, int, std::vector<int>&, std::vector<bool>&)': a.cc:8:13: error: 'N' was not declared in this scope 8 | if(cnt >= N) return -1; | ^ a.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type] 15 | } | ^
s369104354
p03680
C++
#include <bits/stdc++.h> using namespace std; int main () { int N, c = 1; bool b = false; cin >> N; vector<int> vec(N); for (int i = 0; i < N; i++) { cin >> vec.at(i); } int p = vec.at(0); if (p == 2) { cout << 1; } else { for (int i = 0; i < N - 1; i++) { p = vec.at(p); ...
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:4:13: note: to match this '{' 4 | int main () { | ^
s596442787
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,sum,vek; cin >> N; sum=0; vek=1; vector<int> vec(N); for(int i=0;i<N;i++){ cin >> vec.at(i); } if(sum<=N){ if(int i=0; ;i++){ if(vek!=2){ vek=vec.at(vek); sum++; } else{ cout...
a.cc: In function 'int main()': a.cc:13:19: error: expected primary-expression before ';' token 13 | if(int i=0; ;i++){ | ^ a.cc:13:18: error: expected ')' before ';' token 13 | if(int i=0; ;i++){ | ~ ^~ | ) a.cc:13:20: error: 'i' was...
s818581459
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,sum,vek; cin >> N; sum=0; vek=1; vector<int> vec(N); for(int i=0;i<N;i++){ cin >> vec.at(i); } if(sum<=N){ if(int i=0;;i++){ if(vek!=2){ vek=vec.at(vek); sum++; } else{ cout ...
a.cc: In function 'int main()': a.cc:13:18: error: expected primary-expression before ';' token 13 | if(int i=0;;i++){ | ^ a.cc:13:18: error: expected ')' before ';' token 13 | if(int i=0;;i++){ | ~ ^ | ) a.cc:13:19: error: 'i' was not...
s250192036
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,sum,vek; cin >> N; sum=0; vek=1; vector<int> vec(N); for(int i=0;i<N;i++){ cin >> vec.at(i); } if(sum<=N){ if( ; ; ){ if(vek!=2){ vek=vec.at(vek); sum++; } else{ cout << sum ...
a.cc: In function 'int main()': a.cc:13:13: error: expected primary-expression before ';' token 13 | if( ; ; ){ | ^ a.cc:13:12: error: expected ')' before ';' token 13 | if( ; ; ){ | ~ ^~ | ) a.cc:13:15: error: expected primary-expression before ')' to...
s152296841
p03680
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for (int i = 0; i < (n); ++i) #define INF (1LL<<50) #define MOD 1000000007 int main(){ int N; cin >> N; vector<int> a(N+1); vector<int> flag(N+1); rep(i,N){ cin >> a[i+1]; } int cnt = 0; flag[1]...
a.cc: In function 'int main()': a.cc:20:16: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 20 | if(flag(a[i])){ | ~~~~^~~~~~ a.cc:28:13: error: no match for call to '(std::vector<int>) (__gnu_cxx::__alloc_traits<std::alloca...
s112782912
p03680
C++
#include<iostream> #include<vector> using namespace std; int main(){ int N; cin >> N; vector<int> a(N), b; for(int i = 0; i < N; i++){ cin >> a[i]; } int light_on = 0, cnt = 0; while(cnt < 10**6){ light_on = a[light_on]; cnt += 1 if(light_on == 0){ cout << -1; else if(light_on =...
a.cc: In function 'int main()': a.cc:13:18: error: invalid type argument of unary '*' (have 'int') 13 | while(cnt < 10**6){ | ^~ a.cc:15:13: error: expected ';' before 'if' 15 | cnt += 1 | ^ | ; 16 | if(light_on == 0){ | ~~
s009475259
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >>N; vector<int> vec(N); for (int i=0;i<N;i++){ cin>>vec.at(i); } int count=0, first=1; while (true){ count++; first = vec.at(first-1) if (first==2){ cout<<count<<endl; } if (first==vec.at(0)){ cout <...
a.cc: In function 'int main()': a.cc:14:28: error: expected ';' before 'if' 14 | first = vec.at(first-1) | ^ | ; 15 | if (first==2){ | ~~
s813636604
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,x,c_point=0,count=0; cin>>n; vector<int> a(n); for(int i=0;i<n;i++){ cin>>a.at(i)-1; } while(c_point!=1){ if(a.at(c_point)==n){ count=-1; c_point=1; } else{ x=c_point; c_point=a.at(c_point); a.at...
a.cc: In function 'int main()': a.cc:9:8: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 9 | cin>>a.at(i)-1; | ~~~^~~~~~~~~~~ | | | | | ...
s427093165
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,c_point=1,end=0,count=0; cin>>n; vector<int> a(n+1); for(int i=1;i<=n;i++)cin>>a.at(i); while(c_point!=2&&c_point!=0)){ int x=c_point; c_point=a.at(c_point); a.at(x)=0; count++; } if(c_point==2)cout<<count<<"/n"; if(c_poi...
a.cc: In function 'int main()': a.cc:9:32: error: expected primary-expression before ')' token 9 | while(c_point!=2&&c_point!=0)){ | ^
s899662008
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,c_point=1,end=0,count=0; cin>>n; vector<int> a(n+1); for(int i=1;i<=n;i++)cin>>a.at(i); while(!(c_point==2||c_point==0);){ int x=c_point; c_point=a.at(c_point); a.at(x)=0; count++; } if(c_point==2)cout<<count<<"/n"; if(c_...
a.cc: In function 'int main()': a.cc:9:34: error: expected ')' before ';' token 9 | while(!(c_point==2||c_point==0);){ | ~ ^ | ) a.cc:9:35: error: expected primary-expression before ')' token 9 | while(!(c_point==2||c_point==0);){ ...
s967812887
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,cnt; cin >> N; vector<int> std(N,0); for(int i = 0;i < N ;i++) { cin >> std.at(i); } int sv = 0; for(int j = 0;j < N;j++) { cnt++; sv = std.at(sv) if(sv == 2) { cout << cnt << endl; break; } else if(j == N - 1){ cout...
a.cc: In function 'int main()': a.cc:16:24: error: expected ';' before 'if' 16 | sv = std.at(sv) | ^ | ; 17 | if(sv == 2) | ~~ a.cc:22:17: error: 'else' without a previous 'if' 22 | els...
s423030434
p03680
C++
#include <bits/stdc++.h> #include <math.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, n) for (int i = n; i > 0; i--) #define rep3(i, s, e) for (int i = (s); i < (int)(e); i++) #define rep4(i, s, e) for (int i = (e); i < (int)(s); i--) int main() { int n; cin >> n;...
a.cc: In function 'int main()': a.cc:14:17: error: conflicting declaration 'std::vector<int> count' 14 | vector<int> count(n); | ^~~~~ a.cc:12:9: note: previous declaration as 'int count' 12 | int count = 0; | ^~~~~ a.cc:17:22: error: request for member 'at' in 'count',...
s590017518
p03680
C++
#include <bits/stdc++.h> #include <math.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, n) for (int i = n; i > 0; i--) #define rep3(i, s, e) for (int i = (s); i < (int)(e); i++) #define rep4(i, s, e) for (int i = (e); i < (int)(s); i--) int main() { int n; int count...
a.cc: In function 'int main()': a.cc:13:17: error: conflicting declaration 'std::vector<int> count' 13 | vector<int> count(n); | ^~~~~ a.cc:11:9: note: previous declaration as 'int count' 11 | int count = 0; | ^~~~~ a.cc:16:22: error: request for member 'at' in 'count',...
s696760742
p03680
C++
#include <bits/stdc++.h> #include <math.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, n) for (int i = n; i > 0; i--) #define rep3(i, s, e) for (int i = (s); i < (int)(e); i++) #define rep4(i, s, e) for (int i = (e); i < (int)(s); i--) int main() { int n; int count...
a.cc: In function 'int main()': a.cc:13:17: error: conflicting declaration 'std::vector<int> count' 13 | vector<int> count(n); | ^~~~~ a.cc:11:9: note: previous declaration as 'int count' 11 | int count = 0; | ^~~~~ a.cc:16:22: error: request for member 'at' in 'count',...
s500594727
p03680
C++
#include <iostream> #include <string> using namespace std; int main(){ int a, b, c, d, f, m; cin>> a; int a1[a]; for (int i = 0; i< a; i++){ cin>> a1[i]; } f = 0; b1 = false; m = 0; for (int i = 0; i< a; i++){ if (a1[f] == 2){ m++; b1 = true; ...
a.cc: In function 'int main()': a.cc:12:5: error: 'b1' was not declared in this scope; did you mean 'a1'? 12 | b1 = false; | ^~ | a1
s480777516
p03680
C++
#include <iostream> #include <string> using namespace std; int main(){ cin>> a; int a1[a]; for (int i = 0; i< a; i++){ cin>> a1[i]; } f = 0; b1 = false; m = 0; for (int i = 0; i< a; i++){ if (a1[f] == 2){ m++; b1 = true; break; ...
a.cc: In function 'int main()': a.cc:5:11: error: 'a' was not declared in this scope 5 | cin>> a; | ^ a.cc:8:15: error: 'a1' was not declared in this scope 8 | cin>> a1[i]; | ^~ a.cc:10:5: error: 'f' was not declared in this scope 10 | f = 0; | ^ ...
s837227137
p03680
C++
cin>> a; int a1[a]; for (int i = 0; i< a; i++){ cin>> a1[i]; } f = 0; b1 = false; m = 0; for (int i = 0; i< a; i++){ if (a1[f] == 2){ m++; b1 = true; break; } f = a1[f] -1; m++; } if (b1 == true)...
a.cc:1:5: error: 'cin' does not name a type 1 | cin>> a; | ^~~ a.cc:2:12: error: 'a' was not declared in this scope 2 | int a1[a]; | ^ a.cc:3:5: error: expected unqualified-id before 'for' 3 | for (int i = 0; i< a; i++){ | ^~~ a.cc:3:21: error: 'i' does not n...
s224008323
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,pos; cin >> n; vector<int> data(n); for(int i = 0;i < n;i++){ cin >> data.at(i); } for(int count = 0;count < n;count++){ if(count == 0){ pos = data.at(0)-1; } else{ pos = data.at(pos)-1; } if(pos == 1){ ...
a.cc: In function 'int main()': a.cc:22:13: error: 'couont' was not declared in this scope; did you mean 'count'? 22 | else if(couont == n-1){ | ^~~~~~ | count
s779184444
p03680
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<(int)(n);i++) #define fs first #define sc second typedef pair<ll, ll> l_l; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) int main(){ int n; cin>>n; vector<i...
a.cc: In function 'int main()': a.cc:19:7: error: 'j' was not declared in this scope 19 | for(j=0;j<n;j++){ | ^
s017218373
p03680
C++
#pragma GCC optimize "-O3" #pragma GCC target ("CMOV") #define _USE_MATH_DEFINES #include<bits/stdc++.h> #define int long long #define rep(i,n) for(int i=0;i<n;++i) #define vi vector<int> #define vvi vector<vi> #define pb push_back #define pi pair<int,int> #define vp vector<pair<int,int>> #define mp make_pair #define a...
cc1plus: error: attribute 'target' argument 'CMOV' is unknown cc1plus: error: attribute 'target' argument 'CMOV' is unknown
s964738714
p03680
C++
#include <iostream> #include <vector> using namespace std; int main() { int n = 0; cin >> n; vector<int> in(n); vector<bool> check(n, false); for (int i=0; i<n; i++) { cin >> in.at(i); in.at(i)--; } int count = 0; int now = 0; check.at(0) = true; while (true) { now = a.at(now); coun...
a.cc: In function 'int main()': a.cc:19:15: error: 'a' was not declared in this scope 19 | now = a.at(now); | ^
s560146101
p03680
C++
#include <iostream> #include <vector> int main() { int n = 0; cin >> n; vector<int> in(n); vector<bool> check(n, false); for (int i=0; i<n; i++) { cin >> in.at(i); in.at(i)--; } int count = 0; int now = 0; check.at(0) = true; while (true) { now = a.at(now); count++; if (now == 1)...
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin >> n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to sta...
s221592491
p03680
C++
#include <iostream> #include<vector> using namespace std; int main(void) { // Your code here! int a; cin >> a; vector<int> data(a); for (int i = 0; i < a; i++) { int suuzi; cin >> suuzi; data[i] = suuzi - 1; } int box = data[0]; int cnt = 1; while (cnt <= a) { box = data[box]; cnt++; if (box == 1...
a.cc: In function 'int main()': a.cc:33:10: error: expected '}' at end of input 33 | } | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s959096335
p03680
C++
#include<bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N); vector<int> flag(N+1); int count=1; int i; for(i=0; i<N; i++){ cin >> a.at(i); } int current=1; flag.at(1)=1; while(1){ current=a.at(current); count++; flag.at(current)++; if(flag.at(cu...
a.cc: In function 'int main()': a.cc:28:4: error: expected '}' at end of input 28 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s451833578
p03680
C++
#include <sstream> #include <utility> #define ll long long int #define rep(i,x,y) for(int i=x;i<y;i++) #define rel(i,x,y) for(int i=x-1;i>=y;i--) #define all(x) x.begin(),x.end() #define NMAX 100010 using namespace std; int used[NMAX] = {}; bool tmp = false; int cnt =0; void dfs(vector<int> a,int loc){ used[loc] = tru...
a.cc:12:6: error: variable or field 'dfs' declared void 12 | void dfs(vector<int> a,int loc){ | ^~~ a.cc:12:10: error: 'vector' was not declared in this scope 12 | void dfs(vector<int> a,int loc){ | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fi...
s981073691
p03680
C++
#include <iostream> #include <vector> using namespace std; //https://atcoder.jp/contests/abc065/tasks/abc065_b int main(){ int N; cin >> N; vector<int> a(N); for(int i=0;i<N;i++){ cin >> a.at(i); } int light = 1; //最初は1のライトが光ってる int count = 0; for(int i=0;i<N;i++){ ...
a.cc:22:30: error: extended character   is not valid in an identifier 22 | if(light == 2) break; //2が光ったら終了 | ^ a.cc: In function 'int main()': a.cc:22:30: error: '\U00003000' was not declared in this scope 22 | if(light == 2) break; //2が光ったら終了 | ...
s141432216
p03680
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,x=1,b=0;cin>>n; vector<int> a(n); for(int i=0;i<n;i++)cin>>a.at(i); for(int j=0;j<n;j++){ x=a.at(x-1); if(x==2){ b=i+1; break; } } if(b>0)cout<<b<<endl; else cout<<-1<<endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'i' was not declared in this scope 10 | b=i+1; | ^
s286124203
p03680
C++
#include <iostream> using namespace std; int main(){ int N; cin >> N; int count_lst[N]={0}; count_lst[0] = 1; int a_lst[N]; for(int i=0; i<N; i++) cin >> a[i]; int num=1; int count=0; for(int i=0; i<N; i++){ num = a_lst[num-1]; count++; if(count_lst[num-1] == 1){ count = -1; ...
a.cc: In function 'int main()': a.cc:10:33: error: 'a' was not declared in this scope 10 | for(int i=0; i<N; i++) cin >> a[i]; | ^
s688951358
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } int now = 0, c = 0; for (;;) { if (now == 2) { cout << c << endl; break; } if (c >= N) { cout << -1 << endl; break...
a.cc: In function 'int main()': a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s230444744
p03680
C++
#include <stdio.h> #include <vector> #include <algorithm> using namespace std; int main() { int n; scanf("%d",&n); vector<int>v; for(int i=0;i<n;i++){ int tmp; scanf("%d",&tmp); tmp−−; v.push_back(tmp); } int now = 0,c=0; for ( ; ; ){ if(now == 1){ printf("%d\n",c); break; } if( c >= n ){ p...
a.cc:13:17: error: extended character − is not valid in an identifier 13 | tmp−−; | ^ a.cc:13:17: error: extended character − is not valid in an identifier a.cc: In function 'int main()': a.cc:13:17: error: 'tmp\U00002212\U00002212' was not declared in this scope 13 | ...
s264359428
p03680
C++
#include <stdio.h> #include <vector> #include <algorithm> using namespace std; int main() { int n; scanf("%d",&n); vector<int>v; for(int i=0;i<n;i++){ int tmp; scanf("%d",&tmp); tmp−−; v.push_back(tmp); } int now = 0,c=0; for ( ; ; ){ if(now == 1){ printf(”%d\n”,c); break; } if( c >= n ){ p...
a.cc:13:17: error: extended character − is not valid in an identifier 13 | tmp−−; | ^ a.cc:13:17: error: extended character − is not valid in an identifier a.cc:19:24: error: extended character ” is not valid in an identifier 19 | printf(”%d\n”,c); | ...
s230425884
p03680
C++
#include <stdio.h> #include <vector> #include <algorithm> using namespace std; int main() { int n; scanf(”%d”,&n); vector<int>v; for(int i=0;i<n;i++){ int tmp; scanf(”%d”,&tmp); tmp−−; v.push_back(tmp); } int now = 0,c=0; for ( ; ; ){ if(now == 1){ printf(”%d\n”,c); break; } if( c >= n ){ p...
a.cc:8:15: error: extended character ” is not valid in an identifier 8 | scanf(”%d”,&n); | ^ a.cc:8:17: error: extended character ” is not valid in an identifier 8 | scanf(”%d”,&n); | ^ a.cc:12:23: error: extended character ” is not valid in an identifie...
s483219217
p03680
C++
#include<iostream> #include<vector> int main(){ int a; cin >> a; int cur = 1; vector<int> v(a+1); for(int i = 1; i <= a; ++i) cin >> v[i]; for(int i = 0; i < 100009; ++i){ cur = v[cur]; if(cur == 2){ cout << i+1; return 0; } } cout << -1; return 0; }
a.cc: In function 'int main()': a.cc:6:10: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | int a; cin >> a; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ...
s699220324
p03680
C++
#include<iostream> int main(){ int a; cin >> a; int cur = 1; vector<int> v(a+1); for(int i = 1; i <= a; ++i) cin >> v[i]; for(int i = 0; i < 100009; ++i){ cur = v[cur]; if(cur == 2){ cout << i+1; return 0; } } cout << -1; return 0; }
a.cc: In function 'int main()': a.cc:5:10: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | int a; cin >> a; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ...
s555598092
p03680
C++
#include<iostream.h> int main(){ int a; cin >> a; int cur = 1; vector<int> v(a+1); for(int i = 1; i <= a; ++i) cin >> v[i]; for(int i = 0; i < 100009; ++i){ cur = v[cur]; if(cur == 2){ cout << i+1; return 0; } } cout << -1; return 0; }
a.cc:1:9: fatal error: iostream.h: No such file or directory 1 | #include<iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s369944704
p03680
C++
#include<stdio.h> int main(){ int a; cin >> a; int cur = 1; vector<int> v(a+1); for(int i = 1; i <= a; ++i) cin >> v[i]; for(int i = 0; i < 100009; ++i){ cur = v[cur]; if(cur == 2){ cout << i+1; return 0; } } cout << -1; return 0; }
a.cc: In function 'int main()': a.cc:5:10: error: 'cin' was not declared in this scope 5 | int a; cin >> a; | ^~~ a.cc:7:3: error: 'vector' was not declared in this scope 7 | vector<int> v(a+1); | ^~~~~~ a.cc:7:10: error: expected primary-expression before 'int' 7 | vector<int> ...
s069532316
p03680
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int N; cin >> N; int a[N]; for(int i = 0; i < N; i++) { cin >> a[i]; } int b[N]; b[0] = a[0]; int ans = 0; for(int i = 0; i < N; i++) { if(b[i] == 1) { ans ...
a.cc: In function 'int main()': a.cc:35:8: error: 'i' was not declared in this scope 35 | if(i == N) { | ^
s000749790
p03680
C++
using namespace std; #include <bits/stdc++.h> #define rep(i, s) for (int i = 0; i < s; ++i) #define repr(i, n) for(int i = n; i >= 0; i--) #define FOR(i, m, n) for(int i = m; i < n; i++) #define all(v) (v.begin(), v.end()) #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) #define VEC...
a.cc: In function 'int main()': a.cc:35:5: error: 'tmp' was not declared in this scope; did you mean 'tm'? 35 | tmp=nex; | ^~~ | tm
s906443288
p03680
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<int> btn(n); int k=1; for(int i=0;i<n;i++){ cin>>btn[i]; } for(int j=0;j<n+1;j++){ if(btn[k-1]==2)cout<<j+1<<endl; break; else k=btn[k-1]; if(j==n)cout<<-1<<endl; } }
a.cc: In function 'int main()': a.cc:12:5: error: 'else' without a previous 'if' 12 | else k=btn[k-1]; | ^~~~
s069226375
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int count = 1; array<int,10000> a = {}; for (int i = 0; i < n; i++) cin >> ai; array<bool, 10000> check = {}; for (int i = 0; a[i] != 2; i = a[i]-1) { if (check[i]) { count = -1; break; } count++; check[i] = true; }...
a.cc: In function 'int main()': a.cc:11:44: error: 'ai' was not declared in this scope; did you mean 'i'? 11 | for (int i = 0; i < n; i++) cin >> ai; | ^~ | i
s014315715
p03680
C++
#include<iostream> #include<vector> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); for(int i - 0;i < N;i++) { cin >> vec.at(i); } bool A = false; int N = 0; int answer; for(int j = 0;j < N;j++) { N = vec.at(N); if(N == 1) { A = true; answer = j + 1; ...
a.cc: In function 'int main()': a.cc:9:12: error: expected ';' before '-' token 9 | for(int i - 0;i < N;i++) { | ^~ | ; a.cc:9:22: error: expected ')' before ';' token 9 | for(int i - 0;i < N;i++) { | ~ ^ | ) a.cc:9:23: er...
s770457924
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> a(N); for(int i = 0; i < N; ++i){ cin << a.at(i); } int count = 0; int target = 0; while(a.at(target) == 2){ target = a.at(target) - 1; count++; if(count > N){ count = -1; break; } }...
a.cc: In function 'int main()': a.cc:9:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 9 | cin << a.at(i); | ~~~ ^~ ~~~~~~~ | | | | | ...
s269312574
p03680
C++
#include <iostream> #include <vector> using namespace std; int main(void){ int N; cin >> N; vector<int>btn(N,0); for(int i=0;i<N;i++){ cin >> btn[i]; } int now_btn = 0; int ans = 0; while(1){ now_btn = btn[now_btn] - 1; ans++; if(now_btn == 1) break; else if(now_btn...
a.cc: In function 'int main()': a.cc:30:12: error: expected '}' at end of input 30 | return 0; | ^ a.cc:4:15: note: to match this '{' 4 | int main(void){ | ^
s071996204
p03680
C++
#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #ifdef _MSC_VER int getchar_unlocked() { return getchar(); } #endif using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define FOR(i, m, n) for(int i=(m); i<(n); ++i) #define sz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() #define mp ma...
a.cc:126:49: warning: multi-character character constant [-Wmultichar] 126 | while ('0' <= c && c <= '57') { | ^~~~ a.cc:149:41: warning: multi-character character constant [-Wmultichar] 149 | while ('0' <= c && c <= '57')...
s610980653
p03680
C++
コンテスト時間: 2017-06-24(土) 21:00 ~ 2017-06-24(土) 22:40 AtCoderホームへ戻る トップ 問題 質問 提出 提出一覧 順位表 コードテスト 解説 提出 #5552131 ソースコード Copy Copy #include <algorithm> #include <iostream> #include <iomanip> #include <cstring> #include <cstdlib> #include <utility> #include <cstdio> #include <vector> #include <string> #include <qu...
a.cc:10:6: error: stray '#' in program 10 | 提出 #5552131 | ^ a.cc:1:1: error: '\U000030b3\U000030f3\U000030c6\U000030b9\U000030c8\U00006642\U00009593' does not name a type 1 | コンテスト時間: 2017-06-24(土) 21:00 ~ 2017-06-24(土) 22:40 AtCoderホームへ戻る | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/...
s436334626
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> x(N); for(int i=1; i<=N; i++) { cin >> x[i]; } int b=1, ans=0, v; while(x[b] != 2){ if(x[b] = 1) { ans=-1; break; } else{ v=b; ans++; b=x[b]; x[v]=1; } } cou...
a.cc: In function 'int main()': a.cc:24:11: error: 's' was not declared in this scope 24 | cout << s; | ^
s803986174
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> x(N); for(int i=1; i<=N; i++) { cin >> x[i]; } int b=1, ans=0, v; while(x[b] != 2){ if(x[b] = 1) { ans=-1; break; } else{ v=b; ans++; b=x[b]; x[v]=1 } } cout...
a.cc: In function 'int main()': a.cc:21:13: error: expected ';' before '}' token 21 | x[v]=1 | ^ | ; 22 | } | ~ a.cc:24:11: error: 's' was not declared in this scope 24 | cout << s; | ^
s054319408
p03680
C++
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner((System.in)); int N = sc.nextInt(); int[] a = new int[N+1]; int ans = 0; for (int i= 1; i <= N; i++){ a[i] = sc.nextInt(); } int x = 1; while (ans < N){ x = a[x]; ans++; if (x...
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s871511075
p03680
C++
#include <iostream> using namespace std; int main() { int N; cin >> N; int a[N]; for (int i=0; i < N; ++i) { cin >> a[i]; } int ans = 0; bool flag = false; int now = 1; for (int i+0; i < N; ++i) { now = a[now -1]; ++ans; if (now == 2) { flag = true; break; } } if (...
a.cc: In function 'int main()': a.cc:14:13: error: expected ';' before '+' token 14 | for (int i+0; i < N; ++i) { | ^ | ; a.cc:14:22: error: expected ')' before ';' token 14 | for (int i+0; i < N; ++i) { | ~ ^ | ) a.cc:14:...
s916617088
p03680
C++
#include <iostream> using namespace std; int main() { int N; cin >> N; int a[N]; for (int i=0; i < N; ++i) { cin >> a[i]; } int ans = 0; bool flag = false; int now = 1; for (int i+0; i < N; ++i) { now = a[now -1]; ++ans; if (now == 2) { flag = true; break; } } if (...
a.cc: In function 'int main()': a.cc:14:13: error: expected ';' before '+' token 14 | for (int i+0; i < N; ++i) { | ^ | ; a.cc:14:22: error: expected ')' before ';' token 14 | for (int i+0; i < N; ++i) { | ~ ^ | ) a.cc:14:...
s055048214
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> botton(N); int i; for(i=0;i<N;i++){ cin >> botton(i); } int hop; int light; hop = 0; light = 0; for(i=0;i<N;i++){ if(botton.at(light) == 0){ hop = -1; break; } if(botton.at(ligh...
a.cc: In function 'int main()': a.cc:11:18: error: no match for call to '(std::vector<int>) (int&)' 11 | cin >> botton(i); | ~~~~~~^~~
s520638062
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; vector<int> botton(N); int i; for(i=0;i<N;i++){ cin >> botton(i); } int hop; int light; hop = 0; light = 0; for(i=0;i<N;i++){ if(botton.at(light) == 0){ hop = -1; break; } if(botton.at(light) == 1){...
a.cc: In function 'int main()': a.cc:10:18: error: no match for call to '(std::vector<int>) (int&)' 10 | cin >> botton(i); | ~~~~~~^~~
s148181919
p03680
C++
n = int(input()) a = [int(input()) for i in range(n)] c,s=1,a[0] while s != 2 and c < n: c,s = c+1, a[s-1] print(c if c<n else -1)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s098973601
p03680
C++
int main() { int N; cin >> N; vector<int> buttom(N); for (int i = 0; i < N; i++){ cin >> buttom.at(i); } int push = 0; for (int j = 0; j < N; j++){ if (buttom.at(push) == 2){ cout << j + 1 << endl; break; } else{ ...
a.cc: In function 'int main()': a.cc:4:5: error: 'cin' was not declared in this scope 4 | cin >> N; | ^~~ a.cc:6:5: error: 'vector' was not declared in this scope 6 | vector<int> buttom(N); | ^~~~~~ a.cc:6:12: error: expected primary-expression before 'int' 6 | vector<int> bu...
s314312072
p03680
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <string> #include <sstream> #include <complex> #include <vector> #include <list> #include <queue> #include <deque> #include <stack> #include <map> #include <set> using namespace std; int main() { int N, a; int f...
a.cc: In function 'int main()': a.cc:38:25: error: expected primary-expression before '=' token 38 | if (c > = N ) { | ^
s889065714
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(N); cin >> N; for (int i = 0; i < N; i++) { cin >> a.at(i); } for (int j = 0; j < N - 1 ;j++) { a.at(0) = a.at(a.at(0)); if (a.at(0) == 2) { cout << j << endl; break; } } if (a.at(0) !=...
a.cc: In function 'int main()': a.cc:6:17: error: 'N' was not declared in this scope 6 | vector<int> a(N); | ^
s638806893
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } for (int j = 0; j < N - 1 ;j++) { a.at(0) = a.at(a.at(0)); if (a.at(0) == 2) { cout << j << endl; break; } } if (a.at(0) != 2) { co...
a.cc: In function 'int main()': a.cc:6:17: error: 'N' was not declared in this scope 6 | vector<int> a(N); | ^
s964439154
p03680
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define llong long long #define pb(a)...
a.cc:29:11: error: extended character   is not valid in an identifier 29 | int n; //鳩の巣原理よりN+1回押すと絶対1つ以上かぶってる | ^ a.cc: In function 'int main()': a.cc:29:11: error: '\U00003000' was not declared in this scope 29 | int n; //鳩の巣原理よりN+1回押すと絶対1つ以上かぶってる | ^~
s510417121
p03680
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < n; ++i) #define repR(i, n) for(int i = n; i >= 0; ++i) #define FDS(i, n) for(ll i = 0; i < n; ++i) #define FDSR(i, n) for(int i = n; i >= 0; ++i) #define FOR(i, m, n) for(int i = m; i < n; ++i) #define FORR(i, m, n) for(int i = m;i >= n;--i) #define VSORT(v)...
a.cc: In function 'int main()': a.cc:16:9: error: expected ';' before 'vector' 16 | cin>>n | ^ | ; 17 | vector<int> a(n); | ~~~~~~ a.cc:19:10: error: 'a' was not declared in this scope 19 | cin>>a[i]; | ^ a.cc:23:8: error: 'a' was not declared in this...
s155258420
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> v(n); for(int i=0; i < n ; i++) { cin >> v.at(i); } int j = 0; int i = 0; while(i < n) { if(v.at(j) != 2){ j = v.at(j) } i++ if(v.at(j) == 2){ cout << i << endl; } ...
a.cc: In function 'int main()': a.cc:18:18: error: expected ';' before '}' token 18 | j = v.at(j) | ^ | ; 19 | } | ~ a.cc:20:8: error: expected ';' before 'if' 20 | i++ | ^ | ; 21 | if(v.at(j) ...
s853716339
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector v(n); for(int i=0; i < n ; i++) { cin >> v.at(i); } int j = 0; while(i < n) { if(v.at(j) != 2){ j = v.at(j) } i++ if(v.at(j) == 2){ cout << i << endl; } } cout << "-1" << ...
a.cc: In function 'int main()': a.cc:7:13: error: class template argument deduction failed: 7 | vector v(n); | ^ a.cc:7:13: error: no matching function for call to 'vector(int&)' In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, ...
s440065184
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(n + 1); vec.at(0) = 0; for (int i = 1; i < n + 1; i++) cin >> vec.at(i); int b = 1; for (int i = 1; i < n + 1; i++) { b = vec.at(b) if (b == 2) { cout << i << endl; ...
a.cc: In function 'int main()': a.cc:14:22: error: expected ';' before 'if' 14 | b = vec.at(b) | ^ | ; 15 | if (b == 2) { | ~~ a.cc:21:9: error: 'i' was not declared in this scope 21 | if (i == n) cout << -1 << ...
s493887181
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int>a(N); for(int i = 0; i < N; i++){ cin >> a.at(i); } int s = 0, b = 0, c; while(s != 2){ if(a.at(s)== -1){ b = -1; break; } c = s s = a.at(s); a.at(c) = -1; b++; } cout << b <<...
a.cc: In function 'int main()': a.cc:18:10: error: expected ';' before 's' 18 | c = s | ^ | ; 19 | s = a.at(s); | ~
s287457810
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int>a(N); for(int i = 0; i < N; i++){ cin >> a(i); } int s = 0, b = 0; while(s != 2){ if(a.at == -1){ b = -1; break; } s = a.at(s); a.at(s) = -1; b++; } cout << b << endl; }
a.cc: In function 'int main()': a.cc:10:12: error: no match for call to '(std::vector<int>) (int&)' 10 | cin >> a(i); | ~^~~ a.cc:14:14: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator==' 14 | if(a.at == -1){ | ~~~~ ^~ ~~...
s106315515
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int A[N] for (int i = 0; i<N; i++) cin >> A[i]; int s = 1, cnt = 1, tmp; while(s==2) { if(A[s]==-1) {cout << -1 << "\n"; return 0;} tmp = s-1; s = A[s-1]; A[tmp] = -1; cnt++; } cout << cnt << "\n"; }
a.cc: In function 'int main()': a.cc:7:3: error: expected initializer before 'for' 7 | for (int i = 0; i<N; i++) cin >> A[i]; | ^~~ a.cc:7:19: error: 'i' was not declared in this scope 7 | for (int i = 0; i<N; i++) cin >> A[i]; | ^ a.cc:10:8: error: 'A' was not declared in th...
s034993398
p03680
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int cnt = 0; int s = 0; for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } f...
Main.java:13: error: cannot find symbol for(int i=0; i<a.length(); i++){ ^ symbol: method length() location: variable a of type int[] 1 error
s654752722
p03680
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new Int[n]; int cnt = 0; int s = 0; for(int i=0; i<n; i++){ a[i] = sc.nextInt(); } f...
Main.java:6: error: cannot find symbol int[] a = new Int[n]; ^ symbol: class Int location: class Main Main.java:13: error: cannot find symbol for(int i=0; i<a.lenth(); i++){ ^ symbol: method lenth() location: variable a of type int[] 2 errors
s185091977
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i, N; int k; int x; cin >> N; vector<int> vec(N); for (int i=0;i<N;i++){ cin >> vec.at(i); } // 入力はすべてここで終わり。 k = vec.at(0) ; if (k == 2){ cout <<"1" <<endl; }//〇 else if (k == 1){ cout << "-1" <<endl; }//〇 else { for (int i= 2; i =< ...
a.cc: In function 'int main()': a.cc:23:35: error: expected primary-expression before '<' token 23 | for (int i= 2; i =< N ; i++){ | ^
s936123615
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i, N; int k; int x; cin >> N; vector<int> vec(N); for (int i=0;i<N;i++){ cin >> vec.at(i); } // 入力はすべてここで終わり。 k = vec.at(0) ; if (k == 2){ cout <<"1" <<endl; }//〇 else if (k == 1){ cout << "-1" <<endl; }//〇 vec.at(0) = 0; else { for...
a.cc: In function 'int main()': a.cc:23:9: error: 'else' without a previous 'if' 23 | else { | ^~~~
s322437699
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i, N; int k; cin >> N; vector<int> vec(N); for (int i=0;i<N;i++){ cin >> vec.at(i); } //forは一回ここで終わった int k; k = vec.at(0) ; if (k == 2){ cout <<"1" <<endl; } else if (k == 1){ cout << "-1" <<endl; } else { vec.at(0) = 0; for (int i...
a.cc: In function 'int main()': a.cc:13:13: error: redeclaration of 'int k' 13 | int k; | ^ a.cc:6:13: note: 'int k' previously declared here 6 | int k; | ^ a.cc:25:25: error: 'x' was not declared in this scope 25 | x = vec.at(k-1); /...
s317780032
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i, N; cin >> N; vector<int> vec(N); for (int i=0;i<N;i++){ cin >> vec.at(i); } //forは一回ここで終わった int k; k = vec.at(0) ;//1のボタンを押した後に光るボタンがn。それは配列的にはn-1番目の要素。 if (k == 2){ cout <<"1" <<endl; } else if (k == 1){ cout << "-1" <<endl; } el...
a.cc: In function 'int main()': a.cc:49:24: error: expected '}' at end of input 49 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s998605604
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i, N; cin >> N; vector<int> vec(N); for (int i=0;i<N;i++){ cin >> vec.at(i); } int k; k = vec.at(0) ;//1のボタンを押した後に光るボタンがn。それは配列的にはn-1番目の要素。 if (k == "2"){ cout <<"1" <<endl; else if (k == "1"){ cout << "-1" <<endl; } else { vec.at(0) ...
a.cc: In function 'int main()': a.cc:14:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if (k == "2"){ | ~~^~~~~~ a.cc:17:9: error: expected '}' before 'else' 17 | else if (k == "1"){ | ^~~~ a.cc:14:22: note: to match this '{' ...
s761898423
p03680
C++
#include <bits/stdc++.h> using namespace std; class Graph { public: struct Edge { long long to; long long distance; Edge(long long t, long long d) { to = t; distance = d; } bool operator<(const Edge &e) const { return...
a.cc: In member function 'long long int Graph::runKruskal()': a.cc:199:5: warning: no return statement in function returning non-void [-Wreturn-type] 199 | } | ^ a.cc: In function 'int main()': a.cc:214:41: error: conversion from 'vector<long long int>' to non-scalar type 'vector<int>' requested 214 |...
s017632662
p03680
Java
class Main{ public static void main(String arg[]) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[]a = new int[N+1]; for(int i = 1; i <= N; i++) { a[i] = sc.nextInt(); } sc.close(); boolean[] b = new boolean[N+1]; int i = 1; b[1] = true; int count = 0; while(true) { i...
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s905259387
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,; vector<int> v(N); for(int i=0; i<N; i++) { cin >> v[i]; v[i]--; } for(int i=0, next=v[0]; i<N; i++) { if(v[0]==1) { cout << i+1 << endl; return 0; } next=v[next]; } cout << -1 << endl; }
a.cc: In function 'int main()': a.cc:5:9: error: expected unqualified-id before ';' token 5 | int N,; | ^
s712848749
p03680
C++
#include<algorithm> #include<string> #include<math.h> #include<vector> #include<iomanip> using namespace std; int main(void) { int n; cin >> n; vector<int>v; for (int i = 0; i < n; i++) { int z; cin >> z; z--; v.push_back(z); } int now = 0,c = 0; for (;;) { if (now == 1) { cout << c << endl; ...
a.cc: In function 'int main()': a.cc:11:9: error: 'cin' was not declared in this scope 11 | cin >> n; | ^~~ a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 5 | #include<iomanip> +++ |+#include <iostream> 6 | using ...
s890590942
p03680
C++
#include<iostream> #include<algorithm> #include<string> #include<math.h> #include<vector> #include<iomanip> using namespace std; int main(void) { int n; cin >> n; vector<int>v; for (int i = 0; i < n; i++) { int z; cin >> n; z--; v.push_back(z); } int now = 0; c = 0; for (;;) { if (now == 1) { c...
a.cc: In function 'int main()': a.cc:21:22: error: 'c' was not declared in this scope 21 | int now = 0; c = 0; | ^
s290472866
p03680
C++
using namespace std; int main () { int N; cin >> N; vector<int> v; for (int i = 0; i < n; i++) { int z; cin >> z; z−−; v.push_back(z); } int now = 0 ,c = 0; for ( ; ; ) { if( now == 1 ) { cout << c << endl; break; } if (c >= n) { cout << -1 << endl; break;...
a.cc:9:5: error: extended character − is not valid in an identifier 9 | z−−; | ^ a.cc:9:5: error: extended character − is not valid in an identifier a.cc: In function 'int main()': a.cc:4:3: error: 'cin' was not declared in this scope 4 | cin >> N; | ^~~ a.cc:1:1: note: 'std::cin' is def...
s153525700
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N, b; b = 0; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } for (i = 0; i >= 0; i++) { b = a.at(b); if (b == 1){ cout << i << endl; break; }else if (b == 0){ cout << -1 << endl...
a.cc: In function 'int main()': a.cc:13:8: error: 'i' was not declared in this scope 13 | for (i = 0; i >= 0; i++) { | ^
s394399434
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N, b; b = 0; cin >> N; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a.at(i); } for (i = 0; i >= 0; i++) { b = a.at(b); if (b == 1){ cout << i << endl; break; }else if (b == 0){ cout << -1 << endl...
a.cc: In function 'int main()': a.cc:13:8: error: 'i' was not declared in this scope 13 | for (i = 0; i >= 0; i++) { | ^
s381207325
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N, b; b = 0; cin >> N; vector<int> a(N); for (int i = 0; i < N, i++) { cin >> a.at(i); } int i = 1; while () { b = a.at(b); if (b == 1){ cout << i << endl; break; }else if (b == 0){ cout << -1 << endl; ...
a.cc: In function 'int main()': a.cc:10:29: error: expected ';' before ')' token 10 | for (int i = 0; i < N, i++) { | ^ | ; a.cc:14:10: error: expected primary-expression before ')' token 14 | while () { | ^
s542531204
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i) } int count = 0; int a = 1; while (true) { a = A.at(a); count++; if (a == 2) { break; } else if (count > N) { count = -1; ...
a.cc: In function 'int main()': a.cc:9:19: error: expected ';' before '}' token 9 | cin >> A.at(i) | ^ | ; 10 | } | ~
s350861106
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int nazo=-1; vector<int> button(N); vector <int> a(N); for (int i=0; i<N; i++) { cin >> a.at(i); } for (int i=0; i<N-1; i++) { button.at(i+1) = a.at(button.at(i+1)-1); } button.at(0) = 1; for (int i=0; i<N; i+...
a.cc: In function 'int main()': a.cc:24:12: error: expected ';' before '}' token 24 | break | ^ | ; 25 | } | ~
s218509125
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int nazo=-1; vector<int> button(N); vector <int> a(N); for (int i=0; i<N; i++) { cin >> a.at(i); } for (int i=0; i<N-1; i++) { button.at(i+1) = a.at(button(i+1)-1); } button.at(0) = 1; for (int i=0; i<N; i++) ...
a.cc: In function 'int main()': a.cc:16:33: error: no match for call to '(std::vector<int>) (int)' 16 | button.at(i+1) = a.at(button(i+1)-1); | ~~~~~~^~~~~ a.cc:24:12: error: expected ';' before '}' token 24 | break | ^ | ; 25 | } ...
s352184567
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n, i, t, c = 0; cin >> n; a[n+1]; for(i=1; i<=n; i++){ cin >> a[i]; } t = 1 while(c < n){ c++; t = a[t]; if(t == 2){ break; } } if(c == n){ cout << -1; }else...
a.cc: In function 'int main()': a.cc:7:5: error: 'a' was not declared in this scope 7 | a[n+1]; | ^ a.cc:11:10: error: expected ';' before 'while' 11 | t = 1 | ^ | ; 12 | while(c < n){ | ~~~~~
s112604095
p03680
C++
#include<iostream> using namespace std; int main(){ int N;cin>>N; int count=0; int a[100001]; for(int i=1;i<=N;++i){ cin>>a[i]; if(a[i]==i&&a[i]!=2){cout<<"-1"<<endl;return 0;} int v=a[1];++count; for(int i=2;i<=N;++i){ v=a[v];++count; if(v==2){ cout<<count<<endl; ...
a.cc: In function 'int main()': a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s001565990
p03680
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int N; cin >> N; int a[100002]; bool hist[100002]; int count=0; for(int i=0;i<N;i++){ cin >> a[i+1]; hist[i+1] = false; } int curbtn = 1; while(!hist[curbtn]){ ...
a.cc: In function 'int main()': a.cc:26:16: error: expected ';' before 'if' 26 | count++ | ^ | ; 27 | if(curbtn==2) cout << count << endl; return 0; | ~~
s506112592
p03680
C++
#i n cl u d e <s t d i o . h> #i n cl u d e <v e c t o r> #i n cl u d e <al g o ri thm> u si n g namespace s t d ; i n t main ( ) { i n t n ; s c a n f (”%d ” , &n ) ; v e c t o r<i n t>v ; f o r ( i n t i = 0 ; i < n ; i++) { i n t z ; s c a n f (”%d ” , &z ) ; z−−; v . push back ( z ) ; } i n t now = 0 , c = 0 ; f o ...
a.cc:1:2: error: invalid preprocessing directive #i; did you mean #if? 1 | #i n cl u d e <s t d i o . h> | ^ | if a.cc:2:2: error: invalid preprocessing directive #i; did you mean #if? 2 | #i n cl u d e <v e c t o r> | ^ | if a.cc:3:2: error: invalid preprocessing directive #i; did y...
s067374474
p03680
C++
#include <iostream> #include <algorithm> #include <vector> #include <math.h> #include <stdio.h> #include <functional> #include <string> #include <cstdlib> #include <numeric> #include <cstdbool> #include <map> using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return ...
a.cc:18:13: error: array size missing in 'a' 18 | vector<int> a[]; | ^
s225483387
p03680
C++
#include <iostream> #include <algorithm> #include <vector> #include <math.h> #include <stdio.h> #include <functional> #include <string> #include <cstdlib> #include <numeric> #include <cstdbool> #include <map> using namespace std; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return ...
a.cc:18:13: error: array size missing in 'a' 18 | vector<int> a[]; | ^
s321408264
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin>>N; vector<int> buttons(N); for (int i=0;i<N;++i){ cin>>buttons.at(i); } int on = 0; for (int i=0;i<=N;++i){ if (on == 1){ cout << i << endl; return 0; } on = ...
a.cc: In function 'int main()': a.cc:20:28: error: expected ';' before '}' token 20 | on = buttons.at(on) | ^ | ; 21 | } | ~