제출 #846212

#제출 시각아이디문제언어결과실행 시간메모리
846212vjudge1KOVANICE (COI15_kovanice)C++17
0 / 100
262 ms524288 KiB
#include <iostream> #include <string> using namespace std; string ans[300001]; int bak(int cur,int arr[][300001],int ct,int n,int m){ if(ct==n){ ans[cur]=n; return 1; } for (int i=1;i<=m;i++){ if(arr[cur][i]==3){ if(bak(i,arr,ct+1,n,m)){ ans[cur]=ct; } } } if(ans[cur]!="?")return 1; else return 0; } int main() { int n,k,m; cin>>n>>m>>k; int arr[m+1][300001]; for (int i=1;i<=m;i++){ ans[i]="?"; for (int j=1;j<m+1;j++){arr[i][j]=0;} } string a; while(k--) { cin>>a; if(a[1]=='>'){arr[a[0]][a[2]]=3; arr[a[2]][a[0]]=1;} else if(a[1]=='<'){arr[a[0]][a[2]]=1; arr[a[2]][a[0]]=3;} else{arr[a[0]][a[2]]=2; arr[a[2]][a[0]]=2;} } for (int i=1;i<=m;i++){ bak(i,arr,1,n,m); } for (int i=1;i<=m;i++){ cout<<ans[i]<<endl; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

kovanice.cpp: In function 'int main()':
kovanice.cpp:38:31: warning: array subscript has type 'char' [-Wchar-subscripts]
   38 |         if(a[1]=='>'){arr[a[0]][a[2]]=3; arr[a[2]][a[0]]=1;}
      |                               ^
kovanice.cpp:38:37: warning: array subscript has type 'char' [-Wchar-subscripts]
   38 |         if(a[1]=='>'){arr[a[0]][a[2]]=3; arr[a[2]][a[0]]=1;}
      |                                     ^
kovanice.cpp:38:50: warning: array subscript has type 'char' [-Wchar-subscripts]
   38 |         if(a[1]=='>'){arr[a[0]][a[2]]=3; arr[a[2]][a[0]]=1;}
      |                                                  ^
kovanice.cpp:38:56: warning: array subscript has type 'char' [-Wchar-subscripts]
   38 |         if(a[1]=='>'){arr[a[0]][a[2]]=3; arr[a[2]][a[0]]=1;}
      |                                                        ^
kovanice.cpp:39:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   39 |         else if(a[1]=='<'){arr[a[0]][a[2]]=1; arr[a[2]][a[0]]=3;}
      |                                    ^
kovanice.cpp:39:42: warning: array subscript has type 'char' [-Wchar-subscripts]
   39 |         else if(a[1]=='<'){arr[a[0]][a[2]]=1; arr[a[2]][a[0]]=3;}
      |                                          ^
kovanice.cpp:39:55: warning: array subscript has type 'char' [-Wchar-subscripts]
   39 |         else if(a[1]=='<'){arr[a[0]][a[2]]=1; arr[a[2]][a[0]]=3;}
      |                                                       ^
kovanice.cpp:39:61: warning: array subscript has type 'char' [-Wchar-subscripts]
   39 |         else if(a[1]=='<'){arr[a[0]][a[2]]=1; arr[a[2]][a[0]]=3;}
      |                                                             ^
kovanice.cpp:40:22: warning: array subscript has type 'char' [-Wchar-subscripts]
   40 |         else{arr[a[0]][a[2]]=2; arr[a[2]][a[0]]=2;}
      |                      ^
kovanice.cpp:40:28: warning: array subscript has type 'char' [-Wchar-subscripts]
   40 |         else{arr[a[0]][a[2]]=2; arr[a[2]][a[0]]=2;}
      |                            ^
kovanice.cpp:40:41: warning: array subscript has type 'char' [-Wchar-subscripts]
   40 |         else{arr[a[0]][a[2]]=2; arr[a[2]][a[0]]=2;}
      |                                         ^
kovanice.cpp:40:47: warning: array subscript has type 'char' [-Wchar-subscripts]
   40 |         else{arr[a[0]][a[2]]=2; arr[a[2]][a[0]]=2;}
      |                                               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...