submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s545789896 | 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;
}
on = bu... | a.cc: In function 'int main()':
a.cc:18:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
18 | return;
| ^~~~~~
a.cc:20:28: error: expected ';' before '}' token
20 | on = buttons.at(on)
| ^
| ... |
s176446726 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> avec(N);
for (int i = 0; i < N; i++) {
cin >> avec.at(i);
}
int now = 1; cnt = 0;
while(1) {
if (now == 2) {
cout << cnt << endl;
break;
}
if (cnt... | a.cc: In function 'int main()':
a.cc:12:18: error: 'cnt' was not declared in this scope; did you mean 'int'?
12 | int now = 1; cnt = 0;
| ^~~
| int
a.cc:18:20: error: 'n' was not declared in this scope
18 | if (cnt >= n) {
| ^
|
s394705212 | p03680 | C | #include <stdio.h>
int main(){
int n,count=0,point=1;
scanf("%d",&n);
int a[n],b[n];
for (int i=0;i<n;i++){
scanf("%d",&a[i]);
b[i]=0;
}
while(){
if (point==2){
break;
}
if (b[point-1]==1){
count=-1;
break;
}
... | main.c: In function 'main':
main.c:10:12: error: expected expression before ')' token
10 | while(){
| ^
|
s142757612 | p03680 | C | #include <stdio.h>
int main(){
int n,count=0,point=1;
scanf("%d",&n);
int a[n],b[n];
for (int i=0;i<n;i++){
scanf("%d",&a[i]);
b[i]=0;
}
for (int i=0;i<n;i++){
if (point==2){
break;
}
if (point==i+1 && b[i]==1){
count=-1;
... | main.c: In function 'main':
main.c:21:20: error: expected ';' before 'i'
21 | count++
| ^
| ;
22 | i=0;
| ~
|
s100437568 | p03680 | C | #include<stdio.h>
int main(){
int N, b[100000], push, b[100000] = {0}, count = 0;
scanf("%d", &N);
for (i = 0; i < N; i++){
scanf("%d", &a[i]);
}
push = a[0]; b[0] = 1;
while(1){
count++;
if(b[push - 1] == 1){
printf("-1\n");
return 0;
}
if(push == 2){
printf("%d\n"... | main.c: In function 'main':
main.c:4:27: error: redeclaration of 'b' with no linkage
4 | int N, b[100000], push, b[100000] = {0}, count = 0;
| ^
main.c:4:10: note: previous declaration of 'b' with type 'int[100000]'
4 | int N, b[100000], push, b[100000] = {0}, count = 0;
... |
s453415836 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
#define INF (1e9)
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
typedef long long ... | a.cc: In function 'int main()':
a.cc:38:34: error: expected '}' at end of input
38 | if(!flag) cout << -1 << endl;
| ^
a.cc:16:11: note: to match this '{'
16 | int main(){
| ^
|
s839229682 | p03680 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int N,a[100000],b[100000],ans;
cin >> N;
int b[0]=1;
bool X =false;
for (int i=0; i<N; ++i){
b[i+1]=a[b[i]]
if (b[i]==2){
ans=i;
break;
}
}
if (X) cout << ans << endl;... | a.cc: In function 'int main()':
a.cc:8:9: error: conflicting declaration 'int b [0]'
8 | int b[0]=1;
| ^
a.cc:6:21: note: previous declaration as 'int b [100000]'
6 | int N,a[100000],b[100000],ans;
| ^
a.cc:11:23: error: expected ';' before 'if'
11 | b[... |
s605019158 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> buttons(N+1);
for (int i = 1; i <= N; i++) {
cin >> buttons.at(i);
}
// search all
vector<bool> pushed(N+1);
int i = 1;
for (int x = 0; x <= N; x++)
pushed.at(x) = false;
in... | a.cc: In function 'int main()':
a.cc:34:5: error: '\U000000e5' was not declared in this scope
34 | å
| ^
|
s395176388 | p03680 | C++ | #include <iostream>
using namespace std;
int N;
int a[100010];
int main ()
{
cin >> N;
for (int i = 0; i < N; i++) {
cin >> A[i + 1];
}
int cur = 1;
for (int i = 0; i < N; i++) {
cur = a[cur];
if (cur == 2) {
cout << i + 1 << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:16: error: 'A' was not declared in this scope
11 | cin >> A[i + 1];
| ^
|
s535194618 | p03680 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
int n;
cin>>n;
int a[n+1];
int b[n+1]={};
for(int i=1,i<=n,i++)cin>>a[i];
n=1;
b[n]=1;
int count=0;
while(n!=2){n=a[n];if(b[n]){break;cout<<-1<... | a.cc: In function 'int main()':
a.cc:11:22: error: expected ';' before '<=' token
11 | for(int i=1,i<=n,i++)cin>>a[i];
| ^~
| ;
a.cc:11:22: error: expected primary-expression before '<=' token
11 | for(int i=1,i<=n,i++)cin>>a[i];
| ... |
s623058362 | 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, cnt = 0;
while (true) {
if (now == 1) {
cout << cnt << endl;
return 0;
}
if (cnt >= n) {
cout << -1 << endl;
... | a.cc: In function 'int main()':
a.cc:5:9: error: expected unqualified-id before ';' token
5 | int n,;
| ^
|
s662604505 | 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,now=0;
for(;;){
if(now==1){
cout<<c<<endl;
break
}
if(c>=n){
cout<<-1<<endl;
break;
}
c++;
now=A[now];
}
}
| a.cc: In function 'int main()':
a.cc:10:13: error: 'c' was not declared in this scope
10 | cout<<c<<endl;
| ^
a.cc:11:12: error: expected ';' before '}' token
11 | break
| ^
| ;
12 | }
| ~
a.cc:13:8: error: 'c' was not declare... |
s128045217 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N+1);
for(int i=1;i<N+1;i++){
cin >> a[i];
}
int b=1;
for(int i=1;i<N+1;i++){
b=a[b];
if(b==2){
cout << i << endl;
return 0;
break;
}
}
cout << -1 << endl;... | a.cc: In function 'int main()':
a.cc:24:22: error: expected '}' at end of input
24 | cout << -1 << endl;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s544617922 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N+1);
for(int i=1;i<N+1;i++){
cin >> a[i];
}
int b=1;
for(int i=1;i<N+1;i++){
b=a[b];
if(b==2){
cout << i << endl;
return 0;
}
}
cout << -1 << endl;
| a.cc: In function 'int main()':
a.cc:23:22: error: expected '}' at end of input
23 | cout << -1 << endl;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s001498352 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for(i=0;i<N;i++){
cin >> a[i];
}
int b=0;
for(i=0;i<N;i++){
b=a[b]-1;
if(b==1){
cout << i+1 << endl;
break;
return 0;
}
}
cout << -1 << endl;
return 0;
}
| 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:13:7: error: 'i' was not declared in this scope
13 | for(i=0;i<N;i++){
| ^
|
s128843914 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vectro<int> a(N);
for(i=0;i<N;i++){
cin >> a[i];
}
int b=0;
for(i=0;i<N;i++){
b=a[b]-1;
if(b==1){
cout << i+1 << endl;
break;
return 0;
}
}
cout << -1 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:3: error: 'vectro' was not declared in this scope
7 | vectro<int> a(N);
| ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
7 | vectro<int> a(N);
| ^~~
a.cc:8:7: error: 'i' was not declared in this scope
8 | for(i=0;i<N;i++)... |
s557532775 | p03680 | Java | #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];
a[i]--;
}
int k = 0;
int count = 0;
do{
k = a[k];
count++;
}while(k != 0 && k != 1);
if(k == 1) cout << count;
... | Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
^
Main.java:5: error: not a statement
cin >> n;
^
Main.java:6: error: not a statement
vector<int> a(n);
^
Main.java:8: ... |
s824655961 | 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 ) ;
break ;
}
if ( c >=... | a.cc:14:1: error: extended character − is not valid in an identifier
14 | z−−;
| ^
a.cc:14:1: error: extended character − is not valid in an identifier
a.cc: In function 'int main()':
a.cc:14:1: error: 'z\U00002212\U00002212' was not declared in this scope
14 | z−−;
| ^~~
a.cc:15:3: error: 'class std:... |
s119093565 | 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 ) ;
break ;
}
if ( c... | a.cc:8:8: error: extended character ” is not valid in an identifier
8 | scanf (”%d ” , &n ) ;
| ^
a.cc:8:12: error: extended character ” is not valid in an identifier
8 | scanf (”%d ” , &n ) ;
| ^
a.cc:13:8: error: extended character ” is not valid in an identifier
13 | scanf (”... |
s391084244 | 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... |
s982452043 | 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... |
s040957603 | p03680 | C | #include<stdio.h>
#include<string.h>
int a[100001][2];
int main(void) {
int n;
int i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i][0]);
a[i][1] = 1;
}
//ループのiに数列の値を代入してみる//
j = 0;
for (i = 0; i < n; i = a[i][0] - 1) {
if (a[i][0] == 1) {
printf("-1\n");
return 0;
}
if (a[i... | main.c: In function 'main':
main.c:20:9: error: 'j' undeclared (first use in this function)
20 | j = 0;
| ^
main.c:20:9: note: each undeclared identifier is reported only once for each function it appears in
|
s789911561 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 7;
int n;
int a[maxx];
map <int, int> mp;
bool flg;
bool vis[maxx];
int main() {
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = 1; i <= n; i++) mp[a[i]] = i;
int p = 1;
while(p != 2) {
if(flg) break;
if(vis[p]) flg = 1;
vis... | a.cc: In function 'int main()':
a.cc:20:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
20 | cnt++;
| ^~~
| int
a.cc:23:22: error: 'cnt' was not declared in this scope; did you mean 'int'?
23 | else cout << cnt << endl;
... |
s811040981 | p03680 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
vector<int> a(n+1);
for(int i=1;i<=n;i++){
cin >> a.at(i);
}
vector<bool> b(n+1,false);
int ans=0;
int i=1
while(1){
ans++;
b.at(i)=true;
i = a.at(i);
if(i==2){
c... | a.cc: In function 'int main()':
a.cc:13:5: error: expected ',' or ';' before 'while'
13 | while(1){
| ^~~~~
|
s388359486 | 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 ll long long
#define pb(a) pu... | a.cc: In function 'int main()':
a.cc:32:16: error: 'c' was not declared in this scope
32 | if(button==c) break;
| ^
|
s122465255 | p03680 | C++ | #include <iostream>
#include <vector>
int main() {
std::cin >> N;
std::vector<int> a(N);
for (int i = 0; i < N; ++i) {
std::cin >> a[i];
}
int now = a[0];
int cnt = 0;
while(cnt < N) {
int tmp = a[now];
now = a[tmp];
++cnt;
if ( now == 2 ) break;
}
if ( cnt < N ) std::cout << cnt... | a.cc: In function 'int main()':
a.cc:5:15: error: 'N' was not declared in this scope
5 | std::cin >> N;
| ^
|
s380709310 | p03680 | C++ | #include <string>
#include <algorithm>
#include <utility>
#define INF 1000000000
#define MOD 1000000007
using namespace std;
int main()
{
int n;
int ans = 0;
int a[100005];
int v[100005] = {};
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
int now = 1;
while... | a.cc: In function 'int main()':
a.cc:16:5: error: 'cin' was not declared in this scope
16 | cin >> n;
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <utility>
+++ |+#include <iostream>
4 | #define INF 1... |
s270777404 | p03680 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,rept) for(ll i = 0; i<rept;i++)
typedef ... | a.cc: In function 'int main()':
a.cc:47:24: error: 'a' was not declared in this scope
47 | cin >> a[i];
| ^
a.cc:56:21: error: 'a' was not declared in this scope
56 | x = a[x];
| ^
|
s542780839 | p03680 | C++ | #include<bits/stdc++.h>
using namespace std;
int a[100010];
bool f[100010];
int ans;
void dfs(int i,int c){
if(i==2)ans=c;
if(f[a[i]]){
return;
}else{
dfs(a[i]);
}
}
int main(){
int n;cin>>n;
ans=1000000;
for(int i=1;i<=n;i++)cin>>a[i];
dfs(1);
if(ans<1000000){
cout<<ans<<endl;
... | a.cc: In function 'void dfs(int, int)':
a.cc:11:8: error: too few arguments to function 'void dfs(int, int)'
11 | dfs(a[i]);
| ~~~^~~~~~
a.cc:6:6: note: declared here
6 | void dfs(int i,int c){
| ^~~
a.cc: In function 'int main()':
a.cc:18:8: error: too few arguments to function 'void df... |
s273461601 | 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++){
intz;
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){
... | a.cc: In function 'int main()':
a.cc:10:5: error: 'intz' was not declared in this scope; did you mean 'int'?
10 | intz;
| ^~~~
| int
a.cc:11:17: error: 'z' was not declared in this scope
11 | scanf("%d",&z);
| ^
|
s678293401 | 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++){
intz;
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){
... | a.cc:1:9: fatal error: stdio . h: No such file or directory
1 | #include<stdio . h>
| ^~~~~~~~~~~
compilation terminated.
|
s521820833 | p03680 | C++ | n = gets.chomp.to_i
a = readlines.map{|a| a.to_i}
if a.index(2).nil?
puts "-1"
exit
end
a.unshift(0)
count = Array.new(n+1){0}
idx = a[1]
count[1] += 1
while idx != 2 && count.inject(&:+) != n
prv_idx = idx
idx = a[idx]
if prv_idx == a[idx]
puts "-1"
exit
end
count[prv_idx] += 1
end
if ... | a.cc:1:1: error: 'n' does not name a type
1 | n = gets.chomp.to_i
| ^
a.cc:4:1: error: expected unqualified-id before 'if'
4 | if a.index(2).nil?
| ^~
a.cc:12:1: error: 'idx' does not name a type
12 | idx = a[1]
| ^~~
|
s340005618 | p03680 | C++ | n = gets(chomp:true).to_i
a = readlines.map{|a| a.to_i}
if a.index(2).nil?
puts "-1"
exit
end
a.unshift(0)
count = Array.new(n+1){0}
idx = a[1]
count[1] += 1
while idx != 2 && count.inject(&:+) != n
prv_idx = idx
idx = a[idx]
if prv_idx == a[idx]
puts "-1"
exit
end
count[prv_idx] += 1
en... | a.cc:1:1: error: 'n' does not name a type
1 | n = gets(chomp:true).to_i
| ^
a.cc:4:1: error: expected unqualified-id before 'if'
4 | if a.index(2).nil?
| ^~
a.cc:12:1: error: 'idx' does not name a type
12 | idx = a[1]
| ^~~
|
s845936988 | p03680 | C++ | #include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include ... | a.cc: In function 'int main()':
a.cc:49:18: error: 'l' was not declared in this scope
49 | scanf("%d", &l[i]);
| ^
|
s111688096 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int i,array[100001],n[100001]={},c=0,a
cin>>a;
for(i=0;i<a;i++){
cin>>array[i];
}
for(i=0;;){
if(i==2){
cout<<c<<endl;
return 0;
}
if(n[i]==-1){
cout<<n[i]<<endl;
return 0;
}
i=array[i];
n[i]--;
... | a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
6 | cin>>a;
| ^~~
a.cc:7:13: error: 'a' was not declared in this scope
7 | for(i=0;i<a;i++){
| ^
|
s122550926 | p03680 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> a(200000);
for(int i=1;i<=N;i++){
cin >> a.at(i);
}
for( | a.cc: In function 'int main()':
a.cc:12:7: error: expected primary-expression at end of input
12 | for(
| ^
a.cc:12:7: error: expected primary-expression at end of input
a.cc:12:7: error: expected ';' at end of input
12 | for(
| ^
| ;
a.cc:12:7: error: expected primary-expr... |
s033055787 | p03680 | C++ | #include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x) cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) ... | a.cc: In function 'int main()':
a.cc:26:14: error: 'i' was not declared in this scope
26 | l = lamp[i] -1;
| ^
|
s379241933 | p03680 | C++ | #include <iostream>
using namespace std;
int main() {
int n,a=1,b=vec.at(1),x=0;
cin>>n;
vector<int>vec(n);
for(int i=0;i<n;i++){
cin>>vec.at(i);
}
for(int i=0;i<n;i++){
if(b==2){
break;
}
a=b;
b=vec.at(a);
x++
}
if(x==n){
cout<<-1<<endl;
}
else{
cout<<x+1... | a.cc: In function 'int main()':
a.cc:5:21: error: 'vec' was not declared in this scope
5 | int n,a=1,b=vec.at(1),x=0;
| ^~~
a.cc:7:9: error: 'vector' was not declared in this scope
7 | vector<int>vec(n);
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in... |
s066261905 | p03680 | C++ | #include <iostream>
//#include <vector>
using namespace std;
int search(int* arr, int len){
int flag = 0;
if(len > 0){
for(int i = 0; i < len; i++){
if(arr[len] == arr[i]){
flag = 1;
break;
}
}
}
return flag;
}
int main(){
int N;
int a[110000];
cin >> N;
for(int i = ... | a.cc: In function 'int main()':
a.cc:36:9: error: 'num' was not declared in this scope; did you mean 'enum'?
36 | while(num != 2){
| ^~~
| enum
|
s819020839 | p03680 | C++ | #include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
int n;cin>>n;
bool used[n+10]={};
vector<int>bo(n+10)
for(int i=1;i<=n;i++){
cin>>bo[i];
}
int c... | a.cc: In function 'int main()':
a.cc:16:3: error: expected ',' or ';' before 'for'
16 | for(int i=1;i<=n;i++){
| ^~~
a.cc:16:15: error: 'i' was not declared in this scope
16 | for(int i=1;i<=n;i++){
| ^
|
s010283741 | p03680 | C++ | #include<cstdio>
int a[100001],ans,n;
int dispo=1;
bool c[100001];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
if(dispo==2){
printf("%d",ans);
return 0;
}else if(c[dispo]&1){
printf("-1");
return... | a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
8 | cin>>n;
| ^~~
a.cc:20:18: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
20 | ++c[dispo];
| ~~~~~~~^
|
s254919909 | p03680 | C++ | #include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
int pus, n, count = 0, times = 0;
cin >> n;
int buton[n];
for (int i = 0; i < n; i++) {
cin >> buton[i];
}
pus = buton[0];
count = times = 1;
if (pus == 2) {
cout << count << endl;
... | a.cc: In function 'int main()':
a.cc:18:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
18 | return;
| ^~~~~~
|
s022112828 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >>n;
int a[1000001];
for(int i=1;i<=n;i++) {
cin >> a[i];
}
int now=1;
int sum=0;
while(ans==0) {
sum +=1;
if(a[now]==2) {
cout << sum <<endl;break;
}
else if(sum > n) {
cout << -1 <<endl; break;
}... | a.cc: In function 'int main()':
a.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
13 | while(ans==0) {
| ^~~
| abs
|
s319305561 | p03680 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, c = 0;
vector <int> v[n];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> v[i];
}
int a = v[0];
for (int j = 0; j < n; j++) {
if (v[a] == 2) {
cout << c << endl;
break;
} else {
a = v[a];
c++;
}
}
cout << -1 << ... | a.cc: In function 'int main()':
a.cc:10:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>')
10 | cin >> v[i];
| ~~~ ^~ ~~~~
| | |
| | std::vect... |
s803147342 | p03680 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, c = 0;
vector <int> v[n];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> v[i];
}
int a = v[0];
for (int j = 0; j < n; j++) {
if (v[a] == 2) {
cout << 0 << endl;
break;
} else {
a = v[a];
c++;
}
}
cout << "-1" <... | a.cc: In function 'int main()':
a.cc:10:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>')
10 | cin >> v[i];
| ~~~ ^~ ~~~~
| | |
| | std::vect... |
s840225806 | p03680 | C++ | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int a[110000];
for(int i = 0; i < N; i++) cin >> a[i];
int cur_pos = 0;
int count = 0;
bool reachable = true;
int prev_pos1 = 0;
int prev_pos2 = 0;
bool reachable2 = false:
for(int i= 0; i < N; i++) {... | a.cc: In function 'int main()':
a.cc:18:28: error: expected ',' or ';' before ':' token
18 | bool reachable2 = false:
| ^
a.cc:19:19: error: 'i' was not declared in this scope
19 | for(int i= 0; i < N; i++) {
| ^
|
s865393337 | p03680 | C++ | #include <algorithm>
#include <cmath>
using namespace std;
int main(){
int N;
int a[200000];
bool b[200000];
bool clear = false;
int pos = 0;
int count = 1;
cin >> N;
for(int i=0;i<N;++i){
cin >> a[i];
b[i] = true;
}
for(int i=0;i<N;++i){
if(a[pos]-1 == 1){
clear = true;
b... | a.cc: In function 'int main()':
a.cc:13:3: error: 'cin' was not declared in this scope
13 | cin >> N;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <cmath>
+++ |+#include <iostream>
3 | using namespace std... |
s748182475 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=... | a.cc: In function 'int main()':
a.cc:67:2: error: expected '}' at end of input
67 | }
| ^
a.cc:38:11: note: to match this '{'
38 | int main(){
| ^
|
s883987994 | 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];
for(int i = 0;i < N;i++)a[i] = sc.nextInt();
int b = 0;
int c = 0;
for(int i = 0;;i++){
if(a[b] == 2){
System.out.println(i+1);
br... | Main.java:20: error: 'else' without 'if'
else b = c-1;
^
1 error
|
s363777330 | 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];
Light=a[0];
while(Light!=1){
Light=a[Light-1];
if(Light==2){
break;
}
}
if(Light==1) cout << "No" << endl;
if(Light==2) cout << "Yes" << endl;
} | a.cc: In function 'int main()':
a.cc:10:9: error: 'Light' was not declared in this scope
10 | Light=a[0];
| ^~~~~
|
s001879036 | p03680 | C++ | #include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;
#define rep0(n) for(int i=0;i<n;i++)
#define rep(n) for(int i=1;i<=n;i++)
double const pi=3.1415926535;
int printint(int n){
cout<<n<<endl;
return 0;
}
int prints(string s){
cout<<s<<endl;
return 0;
}
int main(){
int... | a.cc: In function 'int main()':
a.cc:27:14: error: conflicting declaration 'bool a [114514]'
27 | bool a[114514];
| ^
a.cc:25:13: note: previous declaration as 'int a [114514]'
25 | int a[114514];
| ^
|
s582089016 | p03680 | C++ | #include<iostream>
using namespace std;
const int max = 100010;
int main() {
int N;
int an[max];
int count = 1;
int index = 0;
bool check = false;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> an[i];
}
for (int i = 0; i < N; i++) {
if (an[index] == 2) {
check = true;
break;
}
count++;
inde... | a.cc: In function 'int main()':
a.cc:7:16: error: reference to 'max' is ambiguous
7 | int an[max];
| ^~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,... |
s280529004 | p03680 | C++ | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <li... | a.cc: In function 'int main()':
a.cc:42:14: error: 'n' was not declared in this scope; did you mean 'yn'?
42 | cin>>n;
| ^
| yn
|
s269690664 | p03680 | C++ | if __name__ == "__main__":
N = int(input())
A = []
for x in range(N):
y = int(input())
y -= 1
A.append(y)
pos = 0
cnt = 0
visited = set()
while (cnt <= N + 1):
visited.add(pos)
if (pos == 1):
print (cnt)
exit()
pos = A[p... | a.cc:1:1: error: expected unqualified-id before 'if'
1 | if __name__ == "__main__":
| ^~
|
s097705694 | p03680 | C++ | //abc065_b Trained?
#include <bits/stdc++.h>
using namespace std;
namespace
{
bool bFlag[ 100010 ];
int a[ 100010 ];
}
int main()
{
int i;
int N;
int iCnt;
cin >> N;
for( i = 1; i <= N; i++ )
{
cin >> a[ i ];
}
iCnt = 1;
i = 1;
while( ! bFlag[ i ] )
{
bFlag[ i ] = true;
if( i == 2 )
{
cout << i... | a.cc: In function 'int main()':
a.cc:38:27: error: expected ';' before '}' token
38 | i = a[ i ]
| ^
| ;
39 | }
| ~
|
s493749225 | p03680 | C++ | button = $stdin.read.split("\n")
button.map! do |element|
element.to_i
end
button.shift()
current = 0
cnt = 0
while true
if current == 1
print("#{cnt}\n")
break
elsif cnt >= button.size
print("-1\n")
break
end
cnt += 1
current = button[current-1]
end
| a.cc:1:1: error: 'button' does not name a type
1 | button = $stdin.read.split("\n")
| ^~~~~~
|
s249300559 | p03680 | C | #include <stdio.h>
#define MAX 10000
int main(void){
int N, c, now, a[MAX];
scanf("%d", &N);
for(i=0;i<N;i++){
scanf("%d", &(a[i]));
a[i]--;
}
c = 0;
now = 0;
while(1){
if(now == 1){
printf("%d\n", c);
break;
}
if(c >= N){
printf("-1\n");
break;
}
... | main.c: In function 'main':
main.c:7:7: error: 'i' undeclared (first use in this function)
7 | for(i=0;i<N;i++){
| ^
main.c:7:7: note: each undeclared identifier is reported only once for each function it appears in
|
s631676875 | p03680 | C++ | #include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
for(int i=0; i<n; i++){
cin>>a[i];
}
int index=0;
int i=0;
while(i<=n){
if(a[index]==2){
cout<<index+1<<endl;
break;
... | a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
9 | cin>>n;
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <algorithm>
+++ |+#include <iostream>
4 |
a.cc:19:13: e... |
s451752422 | p03680 | C++ | int main(void) {
int a;
scanf("%d", &a);
int A[a];
for (int i = 0; i < a; i++ ) {
scanf("%d", &A[i]);
}
int light;
int count = 1;
for (light = A[0]; light != 2; count++) {
if (count >= a ) {
printf("-1");
break;
}
light = A[light-1];
}
if (light ==... | a.cc: In function 'int main()':
a.cc:3:4: error: 'scanf' was not declared in this scope
3 | scanf("%d", &a);
| ^~~~~
a.cc:12:10: error: 'printf' was not declared in this scope
12 | printf("-1");
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probabl... |
s099293361 | p03680 | C++ | #include <iostream>
using namespace std;
#define Nmax 100000
int main() {
int N;
int a;
int start;
int Nnum[Nmax];
scanf("%d", &N);
for (int i = 1; i < N + 1; i++) {
scanf("%d", &a);
Nnum[i] = a;
}
int next = 1;
int count = 0;
while (count<N) {
next = Nnum[next];
count++;
if (next == 2)
break;
... | a.cc: In function 'int main()':
a.cc:26:36: error: expected '}' at end of input
26 | printf("%d\n", -1);
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s610691508 | 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... |
s861083524 | p03680 | C++ | #include <iostream>
using namespace std;
int main()
{
int n, i, j, k, x, y, z, c=0;
cin. tie(0);
for (i = 1; i <= n; i++) cin>> A[i];
x = 1;
c = 0;
mark[1] = 1;
while (x != 2) {
c++;
x=A[x];
if (mark[x]) break;
mark[x] = 1;
}
if(x == 2) cout << c << endl;
else cout << -1 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:32: error: 'A' was not declared in this scope
7 | for (i = 1; i <= n; i++) cin>> A[i];
| ^
a.cc:10:1: error: 'mark' was not declared in this scope
10 | mark[1] = 1;
| ^~~~
a.cc:13:13: error: 'A' was not declared in this scope
13... |
s778736217 | p03680 | C++ | #include <iostream>
using namespace std;
int main()
{
int n,i,j,k,x,y,z,c=0;
cin>>n;
for(i=1;i<=n;++i)cin>>A[i];
x=1;
c=0;
mark[1]=1;
while(x!=2)
{
c++;
x=A[x];if(mark[x])break;
mark[x]=1;
}
if(x==2)cout<<e<<endl;
else cout<<-1<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:31: error: 'A' was not declared in this scope
7 | for(i=1;i<=n;++i)cin>>A[i];
| ^
a.cc:10:9: error: 'mark' was not declared in this scope
10 | mark[1]=1;
| ^~~~
a.cc:14:11: error: 'A' was not declared in this... |
s385541285 | p03680 | C++ | #include<iostream>
using namespace std;
int mark[100001],A[100001]
int main()
{
ios_base::sync_with_stdio(false)
cin.tie(0);
int n,i,j,k,x,y,z,c=0;
cin>>n;
for(i=1;i<=n;++1)cin>>A[i]
x=1;
c=0;
mark[1]=1;
while(x!=2){
c++;
x=A[x];
if(mark[x])break;
mark[x]=1;
}
if(x==2)cout<<c<<end;
else cout<<-1<<endl;
return 0;
}
| a.cc:4:1: error: expected initializer before 'int'
4 | int main()
| ^~~
|
s808514937 | p03680 | C++ | #include <iostream>
#include <utility>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cctype>
#include <string.h>
#include <ctime>
#include <windows.h>
using n... | a.cc:17:10: fatal error: windows.h: No such file or directory
17 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s060374397 | p03680 | C++ | #include <iostream>
#include <utility>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cctype>
#include <string.h>
#include <ctime>
#include <conio.h>
#includ... | a.cc:17:10: fatal error: conio.h: No such file or directory
17 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s893704843 | p03680 | C++ | #include <iostream>
#include <utility>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cctype>
#include <string.h>
#include <ctime>
#include <conio.h>
#includ... | a.cc:17:10: fatal error: conio.h: No such file or directory
17 | #include <conio.h>
| ^~~~~~~~~
compilation terminated.
|
s054700205 | p03680 | C++ | #include<iostream>
#include<Cstring>
using namespace std;
int main(){
int N;
int j=0;
int b=1;
int c[100000];
int d=0;
int a[100000];
cin>>N;
for(int i=1;i<=N;i++){
cin>>a[i];
}
while(b!=2){
c[j]=b;
for(int k=0;k<=j;k++){
if(c[k]==b) d=1;
}
if(d==1) break;
else {
j++;
b=a[b];
}
}
if(d... | a.cc:2:9: fatal error: Cstring: No such file or directory
2 | #include<Cstring>
| ^~~~~~~~~
compilation terminated.
|
s978855219 | p03680 | C++ | // 170613_test.cpp : メイン プロジェクト ファイルです。
#include "stdio.h"
#include "stdafx.h"
using namespace System;
int main()
{
int n;
scanf("%d", &n);
int a[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
int f = 0;
int tmp = 1;
for (int j = 0; j < n; j++) {
tmp = a[tmp - 1];
if (tmp = 2) {
pr... | a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s602400947 | p03680 | Java | package atcoder;
import java.util.Scanner;
import java.io.PrintWriter;
public class TaskB {
public void solve(int testNumber, Scanner in, PrintWriter out) {
int n = in.nextInt();
int[]arr = new int[n+1];
for(int i = 1; i <= n; ++i) {
arr[i] = in.nextInt();
}
bo... | Main.java:6: error: class TaskB is public, should be declared in a file named TaskB.java
public class TaskB {
^
1 error
|
s911419249 | p03680 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
using namespace std;
int vals[100001];
int vis[100001];
int main() {
int N;
scanf("%d",&N);
for (int i = 1; i <= N; i++) {
scanf("%d", &vals[i]);
}
memset(vis, 0, sizeof vis);
bool good = false;
int counter = 0;
int cur = 1;
while (true) {... | a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
13 | memset(vis, 0, sizeof vis);
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cstdio>
+++ |+#include <cstr... |
s925223238 | p03680 | C++ | #include<iostream>
using namespace std;
int main(){
int n,b=1,count=0,d;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
while(a[b-1]!=0 && a[b-1]!=2){
d=b;
b=a[b-1];
a[d-1]=0;
count=count+1;
}
if(a[b-1]==2){
cout<<count+1<<<endl;
}
else{
cout<<"-1"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:32: error: expected primary-expression before '<' token
17 | cout<<count+1<<<endl;
| ^
|
s623382247 | p03680 | C++ | #include<iostream>
using namespace std;
int main(){
int n,b=1,countnt=0,d;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
while(a[b-1]!=0 && a[b-1]!=2){
d=b;
b=a[b-1];
a[d-1]=0;
count=count+1;
}
if(a[b-1]==2){
cout<<count+1<<<endl;
}
else{
cout<<"-1"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:17: error: 'count' was not declared in this scope; did you mean 'countnt'?
14 | count=count+1;
| ^~~~~
| countnt
a.cc:17:23: error: 'count' was not declared in this scope; did you mean 'countnt'?
17 | ... |
s131111122 | p03680 | C++ | #include<iostream>
using namespace std;
int main(){
int n,b=1,c=0,d;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
while(a[b-1]!=0 && a[b-1]!=2){
d=b;
b=a[b-1];
a[d-1]=0;
count=count+1;
}
if(a[b-1]==2){
cout<<count+1<<<endl;
}
else{
cout<<"-1"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:17: error: 'count' was not declared in this scope
14 | count=count+1;
| ^~~~~
a.cc:17:23: error: 'count' was not declared in this scope
17 | cout<<count+1<<<endl;
| ^~~~~
a.cc:17:32: error: ex... |
s190446347 | p03680 | C++ | #include<iostream>
using namespace std;
int main(){
int n,b=1,c=0,d;
cin>>n;
int a[n];
for(int i=0;i<nli++){
cin>>a[i];
}
while(a[b-1]!=0 && a[b-1]!=2){
d=b;
b=a[b-1];
a[d-1]=0;
count=count+1;
}
if(a[b-1]==2){
cout<<count+1<<<endl;
}
else{
cout<<"-1"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:23: error: 'nli' was not declared in this scope
7 | for(int i=0;i<nli++){
| ^~~
a.cc:7:28: error: expected ';' before ')' token
7 | for(int i=0;i<nli++){
| ^
| ;
a... |
s257727272 | p03680 | C++ | #include <iostream>
using namespace std;
int main() {
int n,k=0,i;
bool m1 = true;4
cin >> n;
int *a = new int[n];
for (i = 0; i < n; i++) {
cin >> a[i];
}
i = 0;
while (m1) {
k++;
if (a[i] == 2) { m1 = false;}
else { i = a[i];
if (k > n) { m1 = false; k = -1; }
}
}
cout << k;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:25: error: expected ';' before 'cin'
7 | bool m1 = true;4
| ^
| ;
8 |
9 | cin >> n;
| ~~~
|
s302314017 | p03680 | C++ | #include <iostream>
using namespace std;
int a[123456];
int main(){
int n;cin>>n;
for(int i=0;i<n;++i){cin>>a[i];a[i]--;}
int inf = 200000;
int mi=inf;
int pos=0;
for (int i=0;i<inf;++i){
if(pos==1) mi = min(mi, i);
pos=a[pos];
}
cout<<(mi==inf?-1:mi) << endl; | a.cc: In function 'int main()':
a.cc:14:31: error: expected '}' at end of input
14 | cout<<(mi==inf?-1:mi) << endl;
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s749935849 | p03680 | C++ | N=int(raw_input())
a=[-1]
for _ in range(N):
a.append(int(raw_input()))
i=1
c=0
while(1):
if i==2:
print c
break
elif c>=N:
print -1
break
c+=1
i=a[i]
| a.cc:1:1: error: 'N' does not name a type
1 | N=int(raw_input())
| ^
|
s220661152 | p03680 | C++ | from collections import defaultdict,deque
dic=defaultdict(list)
n=int(input())
for i in range(1,n+1):
num=int(input())
dic[num].append(i)
que=deque()
que.append(2)
co=0
while que:
key=que.popleft()
co+=1
if co>n:
print(str(-1))
break
if key==2:
print(n)
break
... | a.cc:1:1: error: 'from' does not name a type
1 | from collections import defaultdict,deque
| ^~~~
|
s872251071 | p03680 | Java | import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.valueOf(sc.nextInt());
int a[] = new int[N];
int i;
for(i=0; i<N; i++){
a[i] = sc.nextInt();
}
int judge=0;
i = 0;
int count=0;
while(judge != 2){
judge ... | Main.java:3: error: class B is public, should be declared in a file named B.java
public class B {
^
1 error
|
s402074211 | p03680 | Java | import java.io.IOException;
import java.util.Scanner;
public class PB {
public static int searchId(int n, int[] a, int id) throws IOException {
for (int i = 0; i < n; i++) {
if (a[i] == id)
return i + 1;
}
return -1;
}
public static void solve() throws IOException {
Scanner sc = new Scanner(System.i... | Main.java:4: error: class PB is public, should be declared in a file named PB.java
public class PB {
^
1 error
|
s620711616 | p03680 | C++ | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int n, ans;
int a[100005];
int flag;
int main()
{
flag = 0;
ans = 0;
memset(a, 0, sizeof(a));
scanf("%d", &n);
for(int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
}
int p = a[1];
a[1] = 0;
while(true)
{
if(ans ... | a.cc: In function 'int main()':
a.cc:24:39: error: 'o' was not declared in this scope
24 | if(ans > 1000000 || a[o] == 0) {flag = 1; break;}
| ^
|
s236293746 | p03680 | C++ | v | a.cc:1:1: error: 'v' does not name a type
1 | v
| ^
|
s243926926 | p03680 | C++ | #include <iostream>
#include <vector>
#include <alglorithm>
using namespace std;
int main(){
long n;
vector<long> a[100000], res;
cin >> n;
for (long i = 0;i<n;i++) {
long ai;
cin >> ai;
a[(ai-1)].push_back(i);
}
res = a[1];
if (find(res.begin(), res.end(), (long)0)!=res.end()) {
c... | a.cc:3:10: fatal error: alglorithm: No such file or directory
3 | #include <alglorithm>
| ^~~~~~~~~~~~
compilation terminated.
|
s787423600 | p03680 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
long n;
vector<long> a[100000], res;
cin >> n;
for (long i = 0;i<n;i++) {
long ai;
cin >> ai;
a[(ai-1)].push_back(i);
}
res = a[1];
if (find(res.begin(), res.end(), (long)0)!=res.end()) {
cout << 1 << endl;
... | a.cc: In function 'int main()':
a.cc:18:11: error: no matching function for call to 'find(std::vector<long int>::iterator, std::vector<long int>::iterator, long int)'
18 | if (find(res.begin(), res.end(), (long)0)!=res.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/... |
s775485521 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forn(i, s, f) for(int i = (s); i <= (f); ++i)
#define for1(i, f, s) for(int i = (f); i >= (s); --i)
#define fora(i, x) for (auto i : x)
#define show(x) cout << #x << " = " << x << " ";
#define skip continue;
#define pb push_back
#define _1 first
#define _2 second
... | a.cc:29:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
29 | dfs (int v, int h)
| ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
45 | }
| ^
|
s844211619 | p03680 | C++ |
言 2017/6/24 21:10:57
#include <stdio.h>
#define MAX 100000
int main()
{
int n,num=0;
int a[MAX];
int i;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
i=1;
while(1)
{
num++;
if(a[i]==2)
{
printf("%d",num);
break;
}
i=a[i];
if(num>n)
{
printf("-1");
... | a.cc:2:1: error: '\U00008a00' does not name a type
2 | 言 2017/6/24 21:10:57
| ^~
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf' was not declared in this scope
10 | scanf("%d",&n);
| ^~~~~
a.cc:19:25: error: 'printf' was not declared in this scope
19 | ... |
s234434061 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forn(i, s, f) for(int i = (s); i <= (f); ++i)
#define for1(i, f, s) for(int i = (f); i >= (s); --i)
#define fora(i, x) for (auto i : x)
#define show(x) cout << #x << " = " << x << " ";
#define skip continue;
#define pb push_back
#define _1 first
#define _2 second
... | a.cc:29:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
29 | dfs (int v, int h = -1)
| ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
45 | }
| ^
|
s736371674 | p03680 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
long n;
vector<long> a[100000], res;
cin >> n;
for (long i = 0;i<n;i++) {
long ai;
cin >> ai;
a[(ai-1)].push_back(i);
}
// res.insert(res.end(), a[2].begin(), a[2].end());
res = a[1];
if (find(res.begin(), res.end... | a.cc: In function 'int main()':
a.cc:19:11: error: no matching function for call to 'find(std::vector<long int>::iterator, std::vector<long int>::iterator, int)'
19 | if (find(res.begin(), res.end(), 0)!=res.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/local... |
s263087394 | p03680 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forn(i, s, f) for(int i = (s); i <= (f); ++i)
#define for1(i, f, s) for(int i = (f); i >= (s); --i)
#define fora(i, x) for (auto i : x)
#define show(x) cout << #x << " = " << x << " ";
#define skip continue;
#define pb push_back
#define _1 first
#define _2 second
... | a.cc:29:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
29 | dfs (int v, int h = -1)
| ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
45 | }
| ^
|
s701575037 | p03680 | C++ | #include<stdio.h>
#define MAX 100000
int main()
{
int n,num=0;
int a[MAX];
int i ;
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
i=1;
while(1)
{
num++;
if(a[i]==2)
{
printf("%d\n",num);
break;
i=a[i];
if(num>n)
{
printf("-1\n");
break;
}}
return 0;
} | a.cc: In function 'int main()':
a.cc:27:2: error: expected '}' at end of input
27 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s492884170 | p03680 | C++ | 5
3
3
4
2
4 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 5
| ^
|
s245295424 | p03680 | Java | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class B {
public static void Main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] buttons = new int[n];
for(int i=0;i<n;i++){
buttons[i] = sc.nextInt();
}
sc.close();
int glowinB... | Main.java:5: error: class B is public, should be declared in a file named B.java
public class B {
^
1 error
|
s267193122 | p03680 | C++ | #include <iostream>
using namespace std;
int z;
int n;
int x[100005];
int now ;
int counter = 0;
int a;
int main()
{
cin >> n;
for(int i = 0 ; i <= n - 1 ; i ++)
{
cin >> x[i];
}
now = x[0] - 1;
while(1)
{
if(x[now] == 0)
{
counter = -1;
break;
}
a = x[now] - 1;
x[now] = 0;
now = a;
if... | a.cc: In function 'int main()':
a.cc:32:25: error: 'couter' was not declared in this scope; did you mean 'counter'?
32 | couter --;
| ^~~~~~
| counter
|
s169016424 | p03680 | Java | public class Main{
public static void main(String args[] ) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] array = new int[n];
boolean[] b = new boolean[n];
b[0] = true;
for (int i = 1; i < n; i++) b[i] = false;
for (int 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
|
s515465028 | p03680 | Java | import java.util.Scanner;
public class Maiin {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] num = new int[n];
for (int i = 0; i < num.length; i++) {
num[i] = scanner.nextInt();
}
boolean[] check = new boolean[n];
int i = 0;
int ... | Main.java:3: error: class Maiin is public, should be declared in a file named Maiin.java
public class Maiin {
^
1 error
|
s599419302 | p03680 | Java |
import java.util.*;
import java.io.*;
public class abc065_b {
public static void main(String[] args) {
InputReader s = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
/*My code starts here.*/
int n = s.nextInt();
boolean arr[] = new boolean[n+1];
int inp[] = new int[n+1];
fo... | Main.java:5: error: class abc065_b is public, should be declared in a file named abc065_b.java
public class abc065_b {
^
Main.java:56: error: cannot find symbol
comb = new long[MAXN][MAXN];
^
symbol: variable comb
location: class abc065_b
Main.java:56: error: cannot find symbol
comb = new long[MAXN][... |
s177266512 | p03680 | C++ | /*
ID: 5ak0
PROG:
LANG: C++11
*/
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mpr make_pair
#define long long int
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7, MAXN = 1e5 + 10;
int n, a[MAXN], u[MAXN], d[MAXN];
void dfs(i... | a.cc:12:19: error: two or more data types in declaration of 'll'
12 | #define long long int
| ^~~
a.cc:16:9: note: in expansion of macro 'long'
16 | typedef long long ll;
| ^~~~
a.cc:30:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
30 | mai... |
s096865361 | p03680 | C++ | #define N 100000
int n;
int a[N];
int color[N + 1];
int main() {
cin >> n;
for ( int i = 0; i <= N; i++ ) {
a[i] = -1;
}
for ( int i = 1; i <= n; i++ ) {
cin >> a[i];
}
for ( int i = 1, j = 1; i < n; i++ ) {
if ( a[j] == -1 ) {
cout << -1 << endl;
... | a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
8 | cin >> n;
| ^~~
a.cc:19:13: error: 'cout' was not declared in this scope
19 | cout << -1 << endl;
| ^~~~
a.cc:19:27: error: 'endl' was not declared in this scope
19 | ... |
s138717178 | p03681 | C++ | #include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#... | a.cc: In function 'int main()':
a.cc:41:5: error: expected unqualified-id before 'if'
41 | if(N == M){
| ^~
a.cc:43:6: error: 'else' without a previous 'if'
43 | }else if(abs(N - M) == 1){
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.