# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
57435 | 2018-07-15T03:25:59 Z | flflower | 줄서기 (KOI17_line) | C++ | 1000 ms | 668 KB |
#include <bits/stdc++.h> using namespace std; int n,m; int arr[10]; int x[40],y[40]; int main() { int i,j,cnt=0; 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 { 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]); } return 0; } } while(next_permutation(arr,arr+n)); printf("-1\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 564 KB | Output is correct |
4 | Correct | 3 ms | 564 KB | Output is correct |
5 | Correct | 3 ms | 564 KB | Output is correct |
6 | Correct | 20 ms | 668 KB | Output is correct |
7 | Correct | 9 ms | 668 KB | Output is correct |
8 | Correct | 8 ms | 668 KB | Output is correct |
9 | Correct | 8 ms | 668 KB | Output is correct |
10 | Correct | 85 ms | 668 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 564 KB | Output is correct |
4 | Correct | 3 ms | 564 KB | Output is correct |
5 | Correct | 3 ms | 564 KB | Output is correct |
6 | Correct | 20 ms | 668 KB | Output is correct |
7 | Correct | 9 ms | 668 KB | Output is correct |
8 | Correct | 8 ms | 668 KB | Output is correct |
9 | Correct | 8 ms | 668 KB | Output is correct |
10 | Correct | 85 ms | 668 KB | Output is correct |
11 | Execution timed out | 1076 ms | 668 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 564 KB | Output is correct |
4 | Correct | 3 ms | 564 KB | Output is correct |
5 | Correct | 3 ms | 564 KB | Output is correct |
6 | Correct | 20 ms | 668 KB | Output is correct |
7 | Correct | 9 ms | 668 KB | Output is correct |
8 | Correct | 8 ms | 668 KB | Output is correct |
9 | Correct | 8 ms | 668 KB | Output is correct |
10 | Correct | 85 ms | 668 KB | Output is correct |
11 | Execution timed out | 1076 ms | 668 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 564 KB | Output is correct |
4 | Correct | 3 ms | 564 KB | Output is correct |
5 | Correct | 3 ms | 564 KB | Output is correct |
6 | Correct | 20 ms | 668 KB | Output is correct |
7 | Correct | 9 ms | 668 KB | Output is correct |
8 | Correct | 8 ms | 668 KB | Output is correct |
9 | Correct | 8 ms | 668 KB | Output is correct |
10 | Correct | 85 ms | 668 KB | Output is correct |
11 | Execution timed out | 1076 ms | 668 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |