이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |