# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
57437 | 2018-07-15T03:27:29 Z | chungdahm2014 | None (KOI17_line) | C++ | 77 ms | 556 KB |
#include <bits/stdc++.h> using namespace std; int n,m; int arr[10]; int x[50],y[50]; int main() { int i,j; scanf("%d %d",&n,&m); for(i=0;i<m;i++) { scanf("%d %d",&x[i],&y[i]); } for(i=0;i<n;i++) { arr[i]=i+1; } do{ /// 1 bool good=true; for(i=0;i<m;i++) { if(arr[x[i]-1]<arr[y[i]-1]) good=false; } /// 2 int 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]); } return 0; } }while(next_permutation(arr,arr+n)); printf("-1"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 2 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 556 KB | Output is correct |
7 | Correct | 10 ms | 556 KB | Output is correct |
8 | Correct | 8 ms | 556 KB | Output is correct |
9 | Correct | 7 ms | 556 KB | Output is correct |
10 | Correct | 77 ms | 556 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 2 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 556 KB | Output is correct |
7 | Correct | 10 ms | 556 KB | Output is correct |
8 | Correct | 8 ms | 556 KB | Output is correct |
9 | Correct | 7 ms | 556 KB | Output is correct |
10 | Correct | 77 ms | 556 KB | Output is correct |
11 | Incorrect | 2 ms | 556 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 2 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 556 KB | Output is correct |
7 | Correct | 10 ms | 556 KB | Output is correct |
8 | Correct | 8 ms | 556 KB | Output is correct |
9 | Correct | 7 ms | 556 KB | Output is correct |
10 | Correct | 77 ms | 556 KB | Output is correct |
11 | Incorrect | 2 ms | 556 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 436 KB | Output is correct |
4 | Correct | 2 ms | 436 KB | Output is correct |
5 | Correct | 3 ms | 500 KB | Output is correct |
6 | Correct | 18 ms | 556 KB | Output is correct |
7 | Correct | 10 ms | 556 KB | Output is correct |
8 | Correct | 8 ms | 556 KB | Output is correct |
9 | Correct | 7 ms | 556 KB | Output is correct |
10 | Correct | 77 ms | 556 KB | Output is correct |
11 | Incorrect | 2 ms | 556 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |