Submission #57440

#TimeUsernameProblemLanguageResultExecution timeMemory
57440duma3803줄서기 (KOI17_line)C++14
0 / 100
1078 ms580 KiB
#include <bits/stdc++.h> using namespace std; int n,m,arr[10],x[40],y[40],t,j,cnt; int main() { int i; scanf("%d%d",&n,&m); for(i=0;i<m;i++) { for(i=0;i<n;i++) scanf("%d%d",&x[i],&y[i]); } for(i=0;i<n;i++) arr[i] = i+1; do { bool good = true; for(i=0;i<m;i++) { if(arr[x[i]-1]<arr[y[i]-1]) good = false; } cnt=0; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(arr[i]>arr[j]) cnt++; } } if(cnt!=m) good = false; if(good) { for(i=0;i<n;i++) { printf("%d ",arr[i]); } printf("\n"); return 0; } }while(next_permutation(arr,arr+n)); printf("-1\n"); return 0; }

Compilation message (stderr)

line.cpp: In function 'int main()':
line.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
line.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&x[i],&y[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...