# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
57440 | 2018-07-15T03:29:20 Z | duma3803 | None (KOI17_line) | C++14 | 1000 ms | 580 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 288 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 580 KB | Output is correct |
5 | Correct | 2 ms | 580 KB | Output is correct |
6 | Execution timed out | 1078 ms | 580 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 288 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 580 KB | Output is correct |
5 | Correct | 2 ms | 580 KB | Output is correct |
6 | Execution timed out | 1078 ms | 580 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 288 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 580 KB | Output is correct |
5 | Correct | 2 ms | 580 KB | Output is correct |
6 | Execution timed out | 1078 ms | 580 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 288 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 580 KB | Output is correct |
5 | Correct | 2 ms | 580 KB | Output is correct |
6 | Execution timed out | 1078 ms | 580 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |