submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s751214215
p03680
C++
#include<bits/stdc++.h> using namespace std; int button(int n, vector<int> a(n)){ int ret=0; int light=a(n).at(0); a(n).at(0)=0; ret++; while(light!=2&&light!=0){ int k; k=a(n).at(light); a(n).at(light)=0; light=k; ret++; } if(light==0) return -1; ...
a.cc:3:32: error: expected ',' or '...' before '(' token 3 | int button(int n, vector<int> a(n)){ | ^ a.cc: In function 'int button(int, std::vector<int>)': a.cc:5:16: error: no match for call to '(std::vector<int>) (int&)' 5 | int light=a(n).at(0); | ...
s756966732
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<int> vec(N); for(i=0;i<N;i++){ cin>>vec.at(i); } int a=1; for(i=1;i<N;i++){ a=vec.at(a-1); if(a==2){ cout<<i<<endl; return 0; } cout<<-1<<endl; } }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i<N;i++){ | ^ a.cc:12:7: error: 'i' was not declared in this scope 12 | for(i=1;i<N;i++){ | ^
s783030843
p03680
C++
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int main() { ios::sync_with_stdio(0); cin.tie(0); int n = INF; cin >> n; int ans = -1; vector<int> v(n); for(int i = 0;i<n;++i) { int temp; cin >> temp; v.push_back(temp); } int curr = v[0]; for(int i =0;i<n+1;++i) { if(v[curr-1]...
a.cc: In function 'int main()': a.cc:22:24: error: 'nums' was not declared in this scope 22 | curr = nums[curr-1]; | ^~~~
s483520741
p03680
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned int uint; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef pair<int, int> ii; typedef map<int, int> MPII; typedef set<int> ...
a.cc:20:29: warning: overflow in conversion from 'double' to 'int' changes value from '1.000000001e+18' to '2147483647' [-Woverflow] 20 | const int inf = 1e18 + iinf + 10; | ~~~~~~~~~~~~^~~~ a.cc: In function 'int main()': a.cc:46:14: error: 'i' was not declared in this scope 46 | int t = ...
s978213370
p03680
C++
#include<iostream> #include<vector> using namespace std; int main() { int N,cnt = 0; cin>>N; vector<int> a(N); for(int ni=0;ni<N;ni++) { cin>>a.at(ni); cnt++; if(2 == a.at.(ni)) break; } cout<<cnt<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:15: error: invalid use of member function 'std::vector<int>::at' (did you forget the '()' ?) 15 | if(2 == a.at.(ni)) | ~~^~
s502883802
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n ; scanf(”%d ”, &n); vector<int>v; for(int i = 0 ; i < n ; i++) { int z; scanf(”%d ”, &z ); z−−; v.push back(z); } int now = 0 , c = 0 ; for(;;) { if ( now == 1 ) { printf(”%d\n ”, c ); break ; } if ( c >= n ) { printf(”−1\n ”); break ; } c++; now = v[ n...
a.cc:7:7: error: extended character ” is not valid in an identifier 7 | scanf(”%d ”, &n); | ^ a.cc:7:11: error: extended character ” is not valid in an identifier 7 | scanf(”%d ”, &n); | ^ a.cc:12:7: error: extended character ” is not valid in an identifier 12 | scanf(”%d ”, &z );...
s419024167
p03680
C++
#include <bits/stdc++.h> #define fi first #define se second #define REP(i, a, b) for (int i = (a); i <= (b); ++i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORD(i, a, b) for(int i = (a); i > (b); --i) #define REPD(i, a, b) for(int i = (a); i >=(b); --i) #define TR(it, a) for(__typeof(a.begin()) it = ...
a.cc: In function 'void bfs()': a.cc:64:5: error: reference to 'visit' is ambiguous 64 | visit[1] = true; | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80, from a.cc:1: /usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor...
s991429068
p03680
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s243401942
p03680
C++
#include <bits/stdc++.h> #define fi first #define se second #define REP(i, a, b) for (int i = (a); i <= (b); ++i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORD(i, a, b) for(int i = (a); i > (b); --i) #define REPD(i, a, b) for(int i = (a); i >=(b); --i) #define TR(it, a) for(__typeof(a.begin()) it = ...
a.cc: In function 'void bfs()': a.cc:64:5: error: reference to 'visit' is ambiguous 64 | visit[1] = true; | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80, from a.cc:1: /usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor...
s599105102
p03680
C++
#include <bits/stdc++.h> #define fi first #define se second #define REP(i, a, b) for (int i = (a); i <= (b); ++i) #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define FORD(i, a, b) for(int i = (a); i > (b); --i) #define REPD(i, a, b) for(int i = (a); i >=(b); --i) #define TR(it, a) for(__typeof(a.begin()) it = ...
a.cc: In function 'void bfs()': a.cc:64:5: error: reference to 'visit' is ambiguous 64 | visit[1] = true; | ^~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80, from a.cc:1: /usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor...
s226350485
p03680
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long using namespace std; int main() { int n; cin >> n; int cur = 1; int ans = 0; vector<int> a(n+1); vector<bool> l(n+1); rep(i,n) cin >> a[i+1];a rep(i,n) l[i+1] = false; while(1){ ...
a.cc: In function 'int main()': a.cc:15:29: error: expected ';' before 'for' 15 | rep(i,n) cin >> a[i+1];a | ^ | ; a.cc:16:9: error: 'i' was not declared in this scope 16 | rep(i,n) l[i+1] = false; | ^ a.cc:3:35: note: in de...
s013452448
p03680
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ll long long using namespace std; int main() { int n; cin >> n; int cur = 1; int ans = 0; vector<int> a(n+1); vector<bool> l(n+1); rep(i,n) cin >> a[i+1];a rep(i,n) l[i+1] = false; while(1){ ...
a.cc: In function 'int main()': a.cc:15:29: error: expected ';' before 'for' 15 | rep(i,n) cin >> a[i+1];a | ^ | ; a.cc:16:9: error: 'i' was not declared in this scope 16 | rep(i,n) l[i+1] = false; | ^ a.cc:3:35: note: in de...
s768316471
p03680
C++
#include <cstdlib> using namespace std; int a[100000]; int n; int cnt = 1; int botton(int x){ if(cnt > n) { return -1; } if(a[x] == 2) { return cnt; } else { cnt++; return botton(a[x]); } } int main(){ cin >> n; for(int i = 1; i < n+1; i++){ cin >> a[i]; } cout << botton(1) <<...
a.cc: In function 'int main()': a.cc:23:3: error: 'cin' was not declared in this scope 23 | cin >> n; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <cstdlib> +++ |+#include <iostream> 2 | a.cc:27:3: error...
s877244274
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,i,k=0; cin >> N; vector<int> a(N); for(i=0;i<N;++i){ cin >> a.at(i); --a.at(i); } i=0; do{ ++k; i=a.at(i)-; if(i==1) break; }while(--N); if(N) cout << k << endl; else cout << -1 << endl; }
a.cc: In function 'int main()': a.cc:15:15: error: expected primary-expression before ';' token 15 | i=a.at(i)-; | ^
s529445935
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 z; scanf(”%d”, &z); z −−; v. push back(z ); } int now = 0, c = 0; for (;;) { { } }
a.cc:1:19: warning: extra tokens at end of #include directive 1 | #include<stdio.h> #include<vector> #include<algorithm> | ^ a.cc:5:7: error: extended character ” is not valid in an identifier 5 | scanf(”%d”, &n); vector<int>v ; | ^ a.cc:5:9: error: extended character ” is no...
s903787889
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 z; scanf(”%d”, &z); z −−; v. push back(z ); } int now = 0, c = 0; for (;;) { { } }
a.cc:1:20: warning: extra tokens at end of #include directive 1 | #include<stdio .h> #include<vector> #include<algorithm> | ^ a.cc:1:9: fatal error: stdio .h: No such file or directory 1 | #include<stdio .h> #include<vector> #include<algorithm> | ^~~~~~~~~~ compilation ter...
s999838563
p03680
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; using P = pair<int, int>; using ll = long long; int main() { int n; cin >> n; int a[n]; int b = 0; int ans = 0; rep(i, n){ cin >> a[i]; if(a...
a.cc:46:3: error: expected unqualified-id before 'return' 46 | return 0; | ^~~~~~ a.cc:47:1: error: expected declaration before '}' token 47 | } | ^
s812327283
p03680
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; using P = pair<int, int>; using ll = long long; int main() { int n; cin >> n; int a[n]; int b = 0; int ans = 0; rep(i, n){ cin >> a[i]; if(a...
a.cc:44:3: error: expected unqualified-id before 'return' 44 | return 0; | ^~~~~~ a.cc:45:1: error: expected declaration before '}' token 45 | } | ^
s942717499
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int button = 0; int array = 0; int check = 0; int nextlight = 0; int count = 0; cin >> button; vector<int> light(button); for (int loopI = 0; loopI < button; loopI++) { cin >> array; light.at(i) = array; } for (int loopII = 0; loopI...
a.cc: In function 'int main()': a.cc:14:18: error: 'i' was not declared in this scope 14 | light.at(i) = array; | ^
s264584452
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int button = 0; int array = 0; int check = 0; int nextlight = 0; int count = 0; cin >> button; vector<int> light(button); for (int loopI = 0; loopI < button; loopI++) { cin >> array; light.at(i) = array; } for (int loopII = 0; loopI...
a.cc: In function 'int main()': a.cc:14:18: error: 'i' was not declared in this scope 14 | light.at(i) = array; | ^
s243959578
p03680
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; int main() { int n; int i = 1; vector<int> vec(100005); vector<bool> jud(100005); cin >> n; rep(i, n) cin >> vec.at(i + 1); do{ if(jud.at(i) == false){ jud.at(i) = true; i = ve...
a.cc: In function 'int main()': a.cc:19:20: error: expected ';' before '}' token 19 | i = vec.at(i) | ^ | ; 20 | } | ~
s164491899
p03680
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; int main() { int n; int i = 1; vector<int> vec(100005); vector<bool> jud(100005); cin >> n; rep(i, n) cin >> vec.at(i + 1); do{ if(jud.at(i) == false){ jud.at(i) = true; i = ve...
a.cc: In function 'int main()': a.cc:19:20: error: expected ';' before '}' token 19 | i = vec.at(i) | ^ | ; 20 | } | ~ a.cc:28:16: error: 'emdl' was not declared in this scope 28 | cout << i << emdl; | ^...
s242512726
p03680
C++
#include<bits/stdc++.h> #include <string> using namespace std; int X,N; int A[2000010]{}; bool B[2000010]{}; int main() { cin>>N; for(int i=0;i<N;i++)cin>>A[i]; int count=0; for(int i=0;count<N;){ i=A[i]-1; count++; if(i==){ cout<<count; return 0; } } cout<<-1; return 0; } ...
a.cc: In function 'int main()': a.cc:18:11: error: expected primary-expression before ')' token 18 | if(i==){ | ^
s897103979
p03680
C++
#include<bits/stdc++.h> #include <string> using namespace std; string X,N; int A[2000010]{}; bool B[2000010]{}; int main() { cin>>N; for(int i=0;i<N;i++)cin>>A[i]; int count=0; for(int i=0;;){ i=A[i]-1; count++; if(i==0){ cout<<count; return 0; } } cout<<-1; return 0; ...
a.cc: In function 'int main()': a.cc:13:16: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 13 | for(int i=0;i<N;i++)cin>>A[i]; | ~^~ | | | | | std::string {aka std::__cxx11::basic_strin...
s192636567
p03680
C++
テンプレ #include<bits/stdc++.h> #include <string> using namespace std; string X,N; int A[2000010]{}; bool B[2000010]{}; int main() { cin>>N; for(int i=0;i<N;i++)cin>>A[i]; int count=0; for(int i=0;;){ i=A[i]-1; count++; if(i==0){ cout<<count; return 0; } } cout<<-1; return...
a.cc:1:1: error: '\U000030c6\U000030f3\U000030d7\U000030ec' does not name a type 1 | テンプレ | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, ...
s240775229
p03680
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n); ++i) #define ll long long const ll mod = 1e9+7; const ll INF = 1e18; const double pi = acos(-1); int main(void) { ll n; cin>>n; vector<ll> a(n); rep(i,n){ ll b; cin>>b; b--; a[i]=b; } ll...
a.cc:34:1: error: 'v' does not name a type 34 | v | ^
s275139110
p03680
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <map> #include <cmath> #include <iomanip> #include <set> using namespace std; typedef long long ll; int a[1000010]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } int current = a[1]; a[1...
a.cc: In function 'int main()': a.cc:24:9: error: 'i' was not declared in this scope 24 | while(i < 100000000) { | ^
s956143294
p03680
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; bool re = any_of(a.begin(), a.end(), [](int x) {return x == 2;}); if (!re) { cout << -1 << endl; } else { int j = 1, count = 0; ...
a.cc: In function 'int main()': a.cc:8:5: error: 'vector' was not declared in this scope 8 | 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 | us...
s978897737
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int i; int n; cin >> n; vector<int> a(n); for (i = 0; i < n; i++) cin >> a[i]; int count; i = 1; while (int i != 2) { i = a[i]; count++; if (count == 50) { cout << -1 <<endl; ...
a.cc: In function 'int main()': a.cc:15:18: error: expected initializer before '!=' token 15 | while (int i != 2) { | ^~ a.cc:15:17: error: expected ')' before '!=' token 15 | while (int i != 2) { | ~ ^~~ | ) a.cc:15:18: error: expected prim...
s863736836
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); int a; for (int i = 0; i < N; i++) { cin >> a; vec.at(i) = a; } int counter = 0; int b; b = vec.at(0); for (int i = 0; i < N + 1; i++) { if (b == 2) { counter++; cout << ...
a.cc: In function 'int main()': a.cc:28:5: error: 'else' without a previous 'if' 28 | else if (b != 2 && b != 1 && i < N) { | ^~~~
s124685796
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); int a; for (int i = 0; i < N; i++) { cin >> a; vec.at(i) = a; } int counter = 0; int b; b = vec.at(0); for (int i = 0; i < N + 1; i++) { if (b == 2) { counter++; cout << ...
a.cc: In function 'int main()': a.cc:28:5: error: 'else' without a previous 'if' 28 | else if (b != 2 && b != 1 && i < N) { | ^~~~ a.cc:33:31: error: lvalue required as left operand of assignment 33 | else if (b != 2 && b != 1 && i = N + 1) | ~~~~~~~~~~~~~~~~~^~~~
s327206698
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); int a; for (int i = 0; i < N; i++) { cin >> a; vec.at(i) = a; } int counter = 0; int b; b = vec.at(0); for (int i = 0; i < N + 1; i++) { if (b == 2) { counter++; cout << ...
a.cc: In function 'int main()': a.cc:28:5: error: 'else' without a previous 'if' 28 | else if (b != 2 && b != 1 && i < N) { | ^~~~ a.cc:33:31: error: lvalue required as left operand of assignment 33 | else if (b != 2 && b != 1 && i = N + 1) { | ~~~~~~~~~~~~~~~~~^~~~ a.cc:36:2:...
s556630956
p03680
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct array { // the type of elements typedef int TYPE; TYPE* m_data; int m_size; int m_capacity; array(int n) : m_size(n), m_capacity(n+1) { m_data = (TYPE*)malloc(m_capacity * sizeof(TYPE)); if(m_data ==...
main.c:7:5: error: expected specifier-qualifier-list before 'typedef' 7 | typedef int TYPE; | ^~~~~~~ main.c: In function 'main': main.c:77:5: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type] 77 | array a(n); | ^~~~~ main.c:78:25: e...
s013535775
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...
s051071483
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 ans = 0; int lamp = 1; for (int i = 0; i < N; i++) { lamp = a.at(lamp - 1); ans++; if (lamp == 2) break; else if (la...
a.cc: In function 'int main()': a.cc:18:9: error: expected '}' before 'else' 18 | else if (i == N - 1) ans = -1; | ^~~~ a.cc:15:29: note: to match this '{' 15 | else if (lamp == 1) { | ^ a.cc: At global scope: a.cc:21:5: error: 'cout' does not name a...
s433338387
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); int a; for (int i = 0; i < N; i++) { cin >> a; vec.at(i) = a; } int counter = 0; int b, B; b = vec.at(0); for (int i = 0; i < N + 1; i++) { if (b == 2) { counter++; cout ...
a.cc: In function 'int main()': a.cc:38:1: error: expected primary-expression before '}' token 38 | } | ^
s193299766
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++) { int a; cin >> a; vec.at(i) = a; } int counter = 0; int b, B; b = vec.at(0); for (int i = 0; i < N; i++) { if (b == 2) { counter++; cout <<...
a.cc: In function 'int main()': a.cc:31:22: error: expected ';' before 'b' 31 | vec.at(b-1) = B | ^ | ; 32 | b = vec.at(B); | ~
s418526865
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++) { int a; cin >> a; vec.at(i) = a; } int counter; int b; b = vec.at(0); for (int i = 0; i < N; i++) { if (b == 2) { counter++; cout << counte...
a.cc: In function 'int main()': a.cc:27:22: error: expected ';' before 'continue' 27 | b = vec.at(i+1) | ^ | ; 28 | continue; | ~~~~~~~~
s836695497
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec(N); for (i = 0; i < N; i++) { int a; cin >> a; vec.at(i) = a; } int counter; for (i = 0; i < N; i++) { int b; b = vec.at(i); if (b == 2) { counter++; cout << counter << en...
a.cc: In function 'int main()': a.cc:9:8: error: 'i' was not declared in this scope 9 | for (i = 0; i < N; i++) { | ^ a.cc:16:8: error: 'i' was not declared in this scope 16 | for (i = 0; i < N; i++) { | ^
s625942350
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); } for (int i = 0; i < N; i++) { int next = a.at(i); // 次のボタンの位置 if ((next - 1) == i) { // 次のボタンの位置にあるaiの値が現在のボタンの位置だっ...
a.cc: In function 'int main()': a.cc:33:28: error: operands to '?:' have different types 'int' and 'const char*' 33 | cout << ((is_finished) ? count : "-1") << endl; | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
s927837068
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; int ans=0; cin >> N; vector<int> vec(N); for(int i=0;i<N;i++){ cin >> vec.at(i); } vector<int> check; check={}; int k = 1; for(int i =0;i<N;i++){ ans += 1; if(vec.at(k-1)==2){ break; ...
a.cc: In function 'int main()': a.cc:28:16: error: expected ';' before '}' token 28 | ans =-1 | ^ | ; 29 | } | ~
s343822792
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; int ans=0; cin >> N; vector<int> vec(N); for(int i=0;i<N;i++){ cin >> vec.at(i); } vector<int> check; for(int i =0;i<N;i++){ ans += 1 if(vec.at(i)==2){ break; } for(int j=0;j<i+1;j++...
a.cc: In function 'int main()': a.cc:16:13: error: expected ';' before 'if' 16 | ans += 1 | ^ | ; 17 | if(vec.at(i)==2){ | ~~
s810461291
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; int ans=0; cin >> N; vector<int> vec(N); for(int =0;i<N;i++){ cin >> vec.at(i); } vector<int> check; for(int i =0;i<N;i++){ ans += 1 if(vec.at(i)==2){ break; } for(int j=0;j<i+1;j++)...
a.cc: In function 'int main()': a.cc:10:11: error: expected unqualified-id before '=' token 10 | for(int =0;i<N;i++){ | ^ a.cc:10:10: error: expected ';' before '=' token 10 | for(int =0;i<N;i++){ | ^~ | ; a.cc:10:11: error: expected primary-expression before '=' ...
s084913487
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<int> vec(N+1); for(int i=1;i<=N;i++){ cin>>vec.at(i); } int sta=vec.at(1); int kai=0; bool can=false; if(sta==2) cout<<1<<endl; else { for(int i=1;i<=N;i++){ kai+=1; sta=vec.at(sta); ...
a.cc: In function 'int main()': a.cc:31:4: error: expected '}' at end of input 31 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s484481047
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; vector<int> vec(N+1); for(int i=1;i<=N;i++){ cin>>vec.at(i); } int sta=vec.at(1); int kai=1; bool can=false; for(int i=1;i<=N;i++){ kai+=1; sta=vec.at(sta); if(sta==2){ can=true; break; ...
a.cc: In function 'int main()': a.cc:28:23: error: expected '}' at end of input 28 | else cout<<-1<<endl; | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s705128719
p03680
C++
cat
a.cc:1:1: error: 'cat' does not name a type 1 | cat | ^~~
s976807035
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,count=0,i=1; cin>>N; vector <int> totori(N) for(int i=0;i<N;i++)cin>>totori[i]; while(count <= N){ i=totori[i-1]; count++; if(i==2){ cout <<count<<endl; break;} } if(i !=2){cout <<"-1"<<endl;} }
a.cc: In function 'int main()': a.cc:8:5: error: expected ',' or ';' before 'for' 8 | for(int i=0;i<N;i++)cin>>totori[i]; | ^~~ a.cc:8:24: error: expected ';' before ')' token 8 | for(int i=0;i<N;i++)cin>>totori[i]; | ^ | ;
s813493513
p03680
C++
#include <bits/stdc++.h> #include <math.h> #define rep(i,n) for (int i=0;i < (n); ++i) #define ALL(x) (x).begin(), (x).end() using namespace std; using ll = long long; int main() { int n; cin >> n; vector<int> a(n); rep(i,n){ cin >> a[i]; a[i]--; } vector<bool> check(n,false); ...
a.cc: In function 'int main()': a.cc:20:21: error: expected ';' before 'bool' 20 | if (i==1) cnt =0 | ^ | ; 21 | bool stop = false; | ~~~~ a.cc:25:13: error: 'stop' was not declared in this scope 25 | if(!stop){ | ...
s303248055
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> button(N); for(int n = 0; n < N; n++){ cin >> button.at(n); } int light = 1; int count = 1; while(button.at(light-1) != 2){ count++; light = button.at(light-1); if(count > N){ break; } }...
a.cc: In function 'int main()': a.cc:21:7: error: break statement not within loop or switch 21 | break; | ^~~~~
s425256141
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> button(N); for(int n = 0; n < N; n++){ cin >> button.at(n); } int light = 0; int count = 1; while(button.at(light) != 2){ count++; light = button.at(light); if(count > N){ break; } } i...
a.cc: In function 'int main()': a.cc:21:7: error: break statement not within loop or switch 21 | break; | ^~~~~
s431452329
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> button(N); for(int n = 0; n < N; n++){ cin >> button.at(n); } int light = 0; int count = 1; while(button(light) != 2){ count++; light = button(light); if(count > N){ break; } } if(coun...
a.cc: In function 'int main()': a.cc:13:15: error: no match for call to '(std::vector<int>) (int&)' 13 | while(button(light) != 2){ | ~~~~~~^~~~~~~ a.cc:15:19: error: no match for call to '(std::vector<int>) (int&)' 15 | light = button(light); | ~~~~~~^~~~~~~ a.cc:21:7: error...
s737687740
p03680
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<(n); ++i) using namespace std; int main() { int n,flag=0; cin>>n; vector<int>v; for(int i=1,x;i<=n;i++){ cin>>x; --x; v.push_back(x); } int now=0,ans=0; for(;;){ if(now == 1){ cout<<c<<endl; break; } if(c>= n){ cout<<"-...
a.cc: In function 'int main()': a.cc:22:11: error: 'c' was not declared in this scope 22 | cout<<c<<endl; | ^ a.cc:25:7: error: 'c' was not declared in this scope 25 | if(c>= n){ | ^ a.cc:29:4: error: 'c' was not declared in this scope 29 | c++; | ^
s301711757
p03680
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n=sc.nextInt(),f=0,i=0; int[] a=new int[n],b=new int[n]; b[0]=1; for(int i=0;i<n;i++){ a[i]=sc.nextInt(); } while(f<n){ b[i]=0; b[a[i]-1]++; f++...
Main.java:10: error: variable i is already defined in method main(String[]) for(int i=0;i<n;i++){ ^ 1 error
s310841029
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector <int> botton(N); for(int i; i<N; i++){ cin >> botton.at(i); } int count; int now = botton.at(0); for(int i; i<N; i++){ count++; int k = botton.at(now-1) now = botton.at(k); if(now == 2){ cout <...
a.cc: In function 'int main()': a.cc:16:5: error: expected ',' or ';' before 'now' 16 | now = botton.at(k); | ^~~
s944153398
p03680
C++
x#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int N, count = 0, i; vector<int> n(N), find(N); cin >> N; for (int i = 0; i < N; i++) { int tmp; cin >> tmp; n[i] = tmp - 1; ...
a.cc:1:2: error: stray '#' in program 1 | x#include <iostream> | ^ a.cc:1:1: error: 'x' does not name a type 1 | x#include <iostream> | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include...
s082727859
p03680
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int N, count = 0, i; vector<int> n(N), find(N); cin >> N; for (int i = 0; i < N; i++) { int tmp; cin >> tmp; n[i] = tmp - 1; ...
a.cc:45:2: error: stray '#' in program 45 | }#include <iostream> | ^ a.cc:45:3: error: 'include' does not name a type 45 | }#include <iostream> | ^~~~~~~ a.cc:51:5: error: redefinition of 'int main()' 51 | int main(void) | ^~~~ a.cc:7:5: note: 'int main()' previously defined here 7...
s750268415
p03680
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; int num=0; int bottun=1; cin>>n; vector<int>a(n); for(int i=1;i<=n;i++){ cin>>a[i]; } while(bottun!=2){ bottun=a[bottun]; num++; if(num>N) break; } if(num<N) cout<<num<<endl; else cout<<-1<<endl; }
a.cc: In function 'int main()': a.cc:16:12: error: 'N' was not declared in this scope 16 | if(num>N) break; | ^ a.cc:18:10: error: 'N' was not declared in this scope 18 | if(num<N) cout<<num<<endl; | ^
s942305221
p03680
C++
#include <bits/stdc++.h> #include <vector> #include <math.h> using namespace std; #define pi 3.14159265358979323846264338327950L /*#include <bits/stdc++.h> #include <vector> #include <stack> using namespace std; bool comp(int a, int b){ return (a < b); } int main(){ int t; cin>>t; while(t--){ int n...
a.cc: In function 'int main()': a.cc:194:5: error: 'v' was not declared in this scope 194 | v.push_back(--x); | ^ a.cc:207:11: error: 'v' was not declared in this scope 207 | now = v[now]; | ^
s421356195
p03680
C++
#include <bits/stdc++.h> #include <vector> #include <math.h> using namespace std; int main(){ int n,x; cin>>n; vector<int>das; for(int i=0;i<n;i++){ cin>>x; das.push_back(x--); } int now=0,c=0; for(;;){ if(now == 1){ cout<<c<<endl; break; } if(c>=a){ cout<<"-1"<<en...
a.cc: In function 'int main()': a.cc:26:11: error: 'a' was not declared in this scope 26 | if(c>=a){ | ^ a.cc:31:9: error: 'v' was not declared in this scope 31 | now = v[now]; | ^
s214303097
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; //ボタンの数   cin >> N; vector <int> Botton(N); //次に光るボタンのi(番号) for (int i=0; i<N; i++){ cin >> Botton.at(i); } int Ok = -1; //-1は不可能 正の数はボタンを押した回数 int I = 1; //光っているボタンの番号 for (int i=1; i<=N; i++){ if ( Botton.at(I) == ...
a.cc:6:1: error: extended character   is not valid in an identifier 6 |   | ^ a.cc: In function 'int main()': a.cc:6:1: error: '\U00003000' was not declared in this scope 6 |   | ^~ a.cc:22:11: error: 'i' was not declared in this scope 22 | cout << i << endl; | ^
s892011535
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 z ; scanf(”%d” , &z ); z−−; v. push back (z ); } int now = 0 , c = 0; for ( ; ; ) { if (now == 1) { printf(”%d\n” , c ); ...
a.cc:1:9: fatal error: stdio .h: No such file or directory 1 | #include<stdio .h> | ^~~~~~~~~~ compilation terminated.
s920926553
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> a(N+1,-1); for(int i=1; i<=N; i++){ cin >> a.at(i); } int next = 1, count = 1; while(a.at(next)==2 || a.at(next)==-1){ int temp; temp = next; next = a.at(next); a.at(temp) = -1 count++; ...
a.cc: In function 'int main()': a.cc:18:20: error: expected ';' before 'count' 18 | a.at(temp) = -1 | ^ | ; 19 | count++; | ~~~~~
s670533952
p03680
C
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A(n); vector<int> C(n); int count=0; for(int i=0;i<n;i++){ cin >> A.at(i); } int ini=A.at(0); for(int j=0;j<n+1;j++){ count++; if(C.at(ini-1)!=1&&ini!=2){ C.at(ini-1)=1; ini = A.at(ini-1); ...
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s661886813
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 kaunto; int flag; int tugi; }
a.cc: In function 'int main()': a.cc:6:11: error: expected ';' before 'vector' 6 | cin >> N | ^ | ; 7 | vector<int> v(N); | ~~~~~~ a.cc:9:12: error: 'v' was not declared in this scope 9 | cin >> v.at(i); | ^
s023414859
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> btn(N); for ( int i=0; i < N; i++){ cin >> btn[i]; } int c=1; int m,boo; while 1{ boo = btn[btn[m]]; c++; m=boo-1; if ( boo ==2){ break; }else if ( boo==1){ cout<<'-1'<<e...
a.cc:23:13: warning: multi-character character constant [-Wmultichar] 23 | cout<<'-1'<<endl; | ^~~~ a.cc: In function 'int main()': a.cc:16:9: error: expected '(' before numeric constant 16 | while 1{ | ^ | ( a.cc:16:10: error: expected ')' before '{' token ...
s884613688
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin>>N; vector<int> vec(N); int a=0; for(int i=0;i<N;i++){ cin>>vec.at(i); } for(int i=0;i<N;i++){ a=vec.at(a) if(a==2){ cout<<i+1<<endl; break; } } }
a.cc: In function 'int main()': a.cc:13:20: error: expected ';' before 'if' 13 | a=vec.at(a) | ^ | ; 14 | if(a==2){ | ~~
s266953567
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin>>N; vector<int> vec(N); int a=0 for(int i=0;i<N;i++){ cin>>vec.at(i); } for(int i=0;i<N;i++){ a=vec.at(a) if(a==2){ cout<<i+1<<endl; break; } } }
a.cc: In function 'int main()': a.cc:9:5: error: expected ',' or ';' before 'for' 9 | for(int i=0;i<N;i++){ | ^~~ a.cc:9:17: error: 'i' was not declared in this scope 9 | for(int i=0;i<N;i++){ | ^ a.cc:13:20: error: expected ';' before 'if' 13 | a=vec.at(a) ...
s328295234
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,str,point,ans = 0,a; cin >> N; vector<int> n(N,0); for(int i = 0; i < N; i++){ cin >> n.at(i); } str = 1; point = 0; a = 0; for(int i = 0; i < N; i++){ a = n.at(str); str = a; ans += 1; if(a == 2){ break; } ...
a.cc: In function 'int main()': a.cc:22:29: error: expected ';' before 'point' 22 | cout << "-1" << endl | ^ | ; 23 | point = 1; | ~~~~~
s222557950
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,str,point,ans = 0,a; cin >> N; vector<int> n(N,0); for(int i = 0; i < N; i++){ cin >> n.at(i); } str = 1; point = 0; a = 0; for(int i = 0; i < N + 1; i++){ a = n.at(str); str = a; ans += 1; if(a == 2){ break; ...
a.cc: In function 'int main()': a.cc:22:29: error: expected ';' before 'point' 22 | cout << "-1" << endl | ^ | ; 23 | point = 1; | ~~~~~
s854284482
p03680
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N, i, b; cin >> N ; vector<int> a(N); for(i = 0; i < N; i++){ cin >> a.at(i); } b = a.at(0); i = 1 while(i < N){ if(b = 2) break; b = a.at(b); i++; if(i = N){ i = -1; break; } } cout <...
a.cc: In function 'int main()': a.cc:15:8: error: expected ';' before 'while' 15 | i = 1 | ^ | ; 16 | while(i < N){ | ~~~~~
s063315451
p03680
C++
#include<bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1000000007 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long #define vi vector<ll> #define vvi vector<vi> #define BITLE(n) (1LL<<((ll)n)) #define SHIFT_LEFT(n) (1LL<<((ll)n)) #define SUBS(s,f,t) ((s).su...
a.cc: In function 'int main()': a.cc:50:12: error: no matching function for call to 'std::vector<edge>::push_back(long long int)' 50 | E[i].pb(a-1); | ~~~~~~~^~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/in...
s544915243
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,; cin >> n; vector<int> v(n,1); for (int i=0;i<n;i++) { cin >> v.at(i); } for (int i=0;i<n;i++) { if(v.at(0)==2) { cout << i+1 << endl; break; } else if (v.at(0)==1) { cout << -1 << endl; break; } ...
a.cc: In function 'int main()': a.cc:5:9: error: expected unqualified-id before ';' token 5 | int n,; | ^
s771493536
p03680
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i, n) for(int i = 0; i < n; i++) #define repp(i, n) for(int i = 1; i <= n; i++) #define sort(v) sort((v).begin(), (v).end()) #define riverse(v) reverse((v).begin(), (v).end()) using vi = vector<int>; using vs = vector<string>; using vl...
a.cc: In function 'int main()': a.cc:20:9: error: 'frag' was not declared in this scope 20 | frag = false; | ^~~~
s155333913
p03680
C++
#include<stdio . h>#include<vector>#include<algorithm>using namespace std ;int main ()fint n ;scanf ("%d" , &n ) ;vector<int>v ;f o r ( int i = 0; i<n ; i++)fint z ;scanf ("%d" , &z ) ;z
a.cc:1:20: warning: extra tokens at end of #include directive 1 | #include<stdio . h>#include<vector>#include<algorithm>using namespace std ;int main ()fint n ;scanf ("%d" , &n ) ;vector<int>v ;f o r ( int i = 0; i<n ; i++)fint z ;scanf ("%d" , &z ) ;z | ^ a.cc:1:9: fatal error: st...
s179494006
p03680
C++
int main(){ int n; cin >> n; int a[n + 1]; for(int i = 1; i <= n; i++){ cin >> a[i]; } int button = 1; int count = 0; while(1){ //button = a[button]; if(button == a[button]){ break; } else if(button != a[button]){ but...
a.cc: In function 'int main()': a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> n; | ^~~ a.cc:31:9: error: 'printf' was not declared in this scope 31 | printf("%d\n", count); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably f...
s593495993
p03680
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(void){ int n; cin >> n; int a[100005]; for(int i=0; i<n; i++){ cin >> a[i]; } int i = 0; int state[100005] = {0}; state[0] = 1; while(state[i] != 2){ //cout << "while " <<...
a.cc: In function 'int main()': a.cc:45:14: error: expected primary-expression before '>' token 45 | if(i=>n) { | ^
s845745435
p03680
C++
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N+1); A.at(0) = 1; for (int i=1; i<=N; i++) { cin >> A.at(i); } vector<int> A_num(N+1); A_num.at(0) = 1; A_num.at(1) = A.at(1); int num = 1; for (int j=2; j<=N; j++) { A_num.at...
a.cc: In function 'int main()': a.cc:28:4: error: expected '}' at end of input 28 | } | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s443978409
p03680
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) int main() { int N; cin >> N; vector<int> button(N);//0から始まることに注意;; rep(i,N){ int n; cin >> n; button.at(i) = n-1; } //button(i)がai+1に対応 vector<int> route(N); int idou=0,now=0;//now:現在地 route.at(0) ...
a.cc: In function 'int main()': a.cc:19:17: error: no match for call to '(std::vector<int>) (int&)' 19 | now = button(now); | ~~~~~~^~~~~
s890509711
p03680
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) int main() { int N; cin >> N; vector<int> button(N);//0から始まることに注意;; rep(0,N){ int n; cin >> n; button.at(i) = n-1; } //button(i)がai+1に対応 vector<int> route(N); int idou=0,now=0;//now:現在地 route.at(0) ...
a.cc: In function 'int main()': a.cc:9:7: error: expected unqualified-id before numeric constant 9 | rep(0,N){ | ^ a.cc:3:26: note: in definition of macro 'rep' 3 | #define rep(i,n) for(int i=0;i<(int)(n);i++) | ^ a.cc:9:7: error: expected ';' before numeric constant...
s377314321
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<int> arr(1000000); int N; cin >> N; int count = 1; for (int i = 0; i < N; i++) { cin >> arr.at(i); } int a; int flag = 0; while (1) { int x = 1; x = arr.at(arr.at(x - 1)) count ++; if (arr.at(x) = 2) { ...
a.cc: In function 'int main()': a.cc:20:30: error: expected ';' before 'count' 20 | x = arr.at(arr.at(x - 1)) | ^ | ; 21 | count ++; | ~~~~~
s031340121
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<int> arr(1000000); int N; cin >> N; int count = 1; for (int i = 0; i < N; i++) { cin >> arr.at(i); } int a; int flag = 0; while (1) { int x = 1 x = arr.at(arr.at(x - 1)) count ++; if (arr.at(x) = 2) { ...
a.cc: In function 'int main()': a.cc:20:5: error: expected ',' or ';' before 'x' 20 | x = arr.at(arr.at(x - 1)) | ^
s898440417
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<int> arr(1000000); int N; cin >> N; int count = 1; for (int i = 0; i < N; i++;) { cin >> arr.at(i); } int a; int flag = 0; while (1) { int x = 1 x = arr.at(arr.at(x - 1)) count ++; if (arr.at(x) = 2) { ...
a.cc: In function 'int main()': a.cc:11:29: error: expected ')' before ';' token 11 | for (int i = 0; i < N; i++;) { | ~ ^ | ) a.cc:11:30: error: expected primary-expression before ')' token 11 | for (int i = 0; i < N; i++;) { | ...
s091768954
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); } vector<int> flags(N); int on=0; int count=0; while(True){ on = buttons.at(on); count++; if(on==2) cout << count << endl; ...
a.cc: In function 'int main()': a.cc:16:9: error: 'True' was not declared in this scope 16 | while(True){ | ^~~~
s233346214
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); } vector<int> flags(N); int on=0; int count=0; while(True){ on = buttons.at(on); count++; if(on==2) cout << count << endl; ...
a.cc: In function 'int main()': a.cc:9:3: error: expected ',' or ';' before 'for' 9 | for(int i=0;i<N;i++){ | ^~~ a.cc:9:15: error: 'i' was not declared in this scope 9 | for(int i=0;i<N;i++){ | ^ a.cc:16:9: error: 'True' was not declared in this scope 16 | while(True){ ...
s403253767
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; int a[N]; for (i = 0; i < N; i++) cin >> a[i]; int button = 1; int ans = 0; while (button != 1) { button = a[button]; ans++; if (button == 2){ cout << ans << endl; return 0; } cout << -1 ...
a.cc: In function 'int main()': a.cc:9:8: error: 'i' was not declared in this scope 9 | for (i = 0; i < N; i++) cin >> a[i]; | ^ a.cc:23:2: error: expected '}' at end of input 23 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s560381958
p03680
C++
n = int(input()) a = [int(input()) for _ in range(n)] cnt = 0 cur = 1 if a[0] == 2: print(1) else: for i in range(n): cnt += 1 cur = a[cur - 1] if cur == 2: print(cnt) exit() print(-1)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s857237429
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 all(x) (x).begin(),(x).end() int main() { int n; cin >> n; vectore<int> a(n); for (int i = 0; i < n; i ++) { cin >> a[i]; } vector<bool> b(n, true); int on = 0; int cnt = ...
a.cc: In function 'int main()': a.cc:9:3: error: 'vectore' was not declared in this scope 9 | vectore<int> a(n); | ^~~~~~~ a.cc:9:11: error: expected primary-expression before 'int' 9 | vectore<int> a(n); | ^~~ a.cc:11:12: error: 'a' was not declared in this scope 11 | cin >> ...
s945702826
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 button = 1; int count = 0; while (button != 2){ button = a.at(button); count++; if (count !< N){ cout << -1 << endl; break; ...
a.cc: In function 'int main()': a.cc:17:14: error: expected ')' before '!' token 17 | if (count !< N){ | ~ ^~ | )
s383558177
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; vector a(N); for (int i = 0; i < N; i++){ cin >> a.at(i); } int button = 1; int count = 0; while (button != 2){ button = a.at(button); count++; if (count > 2*N){ cout << -1 << endl; break; } } cout <...
a.cc: In function 'int main()': a.cc:6:13: error: class template argument deduction failed: 6 | vector a(N); | ^ a.cc:6: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, ...
s145641970
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; for (int i=0; i < 2*N; i = vec.at(i)-1) { else if (vec.at(i)==2) { cout << count+1 << endl; break; } else if (i==2*...
a.cc: In function 'int main()': a.cc:16:5: error: 'else' without a previous 'if' 16 | else if (vec.at(i)==2) { | ^~~~
s627085862
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; for (int i=0; i < N; i = vec.at(i)-1) { if (vec.at(i)==1) { cout << -1 << endl; break; } else if (vec.at(i)==2) { ...
a.cc: In function 'int main()': a.cc:27:4: error: expected '}' at end of input 27 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s397645423
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 button = 1; int i = 0; for(int j = 0; j < N; j++){ i++; button = a.at(button - 1); if(button == 2)break; if(button == 1 || j = N - 1){ cout <<...
a.cc: In function 'int main()': a.cc:16:20: error: lvalue required as left operand of assignment 16 | if(button == 1 || j = N - 1){ | ~~~~~~~~~~~~^~~~
s812299122
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 button = 1; int i = 0; for(int j = 0; j < N; j++){ i++; button = a.at(button - 1); if(button == 2)break; if(button == 1 || i = N - 1){ cout <<...
a.cc: In function 'int main()': a.cc:16:20: error: lvalue required as left operand of assignment 16 | if(button == 1 || i = N - 1){ | ~~~~~~~~~~~~^~~~
s400313463
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; int A[100005]; cin>>n; for(int i=0;i<n;i++){ cin>>A[i]; } int temp=A[0]; int c=1; while(100005--){ c++; if (A[temp-1]==2){ cout<<c; return 0; } temp=A[temp-1]; } cout<<-1; return 0; }
a.cc: In function 'int main()': a.cc:13:15: error: lvalue required as decrement operand 13 | while(100005--){ | ^~~~~~
s376427557
p03680
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s034803314
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> v; for (int i=0; i<N; i++) { int x; cin >> x; v.push_back(x); } int y=0; z=0; for (int i=0; i<N; i++) { if (z==1) { cout << y << endl; break; } if (y>=N) { cout << "-1" << endl; ...
a.cc: In function 'int main()': a.cc:11:12: error: 'z' was not declared in this scope 11 | int y=0; z=0; | ^
s622855313
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> v; for (int i=0; i<N; i++) { int x; cin >> x; v.push_back(x); } int y=0; z-0; for (int i=0; i<N; i++) { if (z==1) { cout << y << endl; break; } if (y>=N) { cout << "-1" << endl; ...
a.cc: In function 'int main()': a.cc:11:12: error: 'z' was not declared in this scope 11 | int y=0; z-0; | ^
s272458450
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(n); vector<int> past(0); int flag = 0; int count = 0; for (int i = 0; i < n; i++) { cin >> vec[i]-1; if(vec[i] == 1) flag = 1; } if(flag == 1){ int next = vec[0]; count++; past.push_ba...
a.cc: In function 'int main()': a.cc:13: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'}) 13 | cin >> vec[i]-1; | ~~~ ^~ | | | std::istream {aka st...
s932162070
p03680
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vec(n); vector<int> past(0); int flag = 0; int count = 0; for (int i = 0; i < n; i++) { cin >> vec[i]; if(vec[i] == 2) flag = 1; } if(flag == 1){ int next = vec[0]; count++; past.push_back...
a.cc: In function 'int main()': a.cc:21:21: error: lvalue required as left operand of assignment 21 | while(next != 2 && flag = 1){ | ~~~~~~~~~~^~~~~~~
s907819144
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 y=A.at(0); int cnt=0; for (int i=0; i<N; i++){ y=A.at(y-1); cnt++; if (y==2){ cout << cnt+1 << endl; break; } } if (y!=2)...
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() { | ^