# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
57434 | 2018-07-15T03:23:25 Z | daniel060811 | None (KOI17_line) | C++ | 1000 ms | 596 KB |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[1000000]; int arr[1000000]; int main() { int n, i, j, m, cnt; scanf("%d %d", &n, &m); for(i=0; i<m; i++) { scanf("%d %d", &a[i].first, &a[i].second); } for(i=0; i<n; i++) arr[i]=i+1; do { cnt=0; bool good = true; for(i=0; i<m; i++) { if(arr[a[i].first-1]<arr[a[i].second-1]) good=false; } 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==true) { for(i=0; i<n; i++) printf("%d ", arr[i]); return 0; } }while(next_permutation(arr, arr+n)); printf("-1"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 4 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 532 KB | Output is correct |
7 | Correct | 10 ms | 532 KB | Output is correct |
8 | Correct | 8 ms | 532 KB | Output is correct |
9 | Correct | 9 ms | 532 KB | Output is correct |
10 | Correct | 74 ms | 580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 4 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 532 KB | Output is correct |
7 | Correct | 10 ms | 532 KB | Output is correct |
8 | Correct | 8 ms | 532 KB | Output is correct |
9 | Correct | 9 ms | 532 KB | Output is correct |
10 | Correct | 74 ms | 580 KB | Output is correct |
11 | Execution timed out | 1087 ms | 596 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 4 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 532 KB | Output is correct |
7 | Correct | 10 ms | 532 KB | Output is correct |
8 | Correct | 8 ms | 532 KB | Output is correct |
9 | Correct | 9 ms | 532 KB | Output is correct |
10 | Correct | 74 ms | 580 KB | Output is correct |
11 | Execution timed out | 1087 ms | 596 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 4 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 532 KB | Output is correct |
7 | Correct | 10 ms | 532 KB | Output is correct |
8 | Correct | 8 ms | 532 KB | Output is correct |
9 | Correct | 9 ms | 532 KB | Output is correct |
10 | Correct | 74 ms | 580 KB | Output is correct |
11 | Execution timed out | 1087 ms | 596 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |