# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
57432 | 2018-07-15T03:20:08 Z | dakara2006 | 줄서기 (KOI17_line) | C++ | 1000 ms | 708 KB |
#include <bits/stdc++.h> using namespace std; pair<int,int> a[100005]; int arr[100005],num[100005],cnt,i,j,hap; int main() { int n,m; 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; for(i=0;i<m;i++) { if(arr[a[i].first-1]>arr[a[i].second-1]) cnt++; else break; } if(cnt==m) { cnt=0; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(arr[i]>arr[j]) cnt++; } } if(cnt==m) { hap=0; for(i=0;i<n;i++) { num[i]=arr[i]; hap+=num[i]; } } } }while(next_permutation(arr,arr+n)); if(hap==0) { printf("-1"); return 0; } for(i=0;i<n;i++) { printf("%d ",num[i]); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 540 KB | Output is correct |
4 | Correct | 3 ms | 540 KB | Output is correct |
5 | Correct | 4 ms | 540 KB | Output is correct |
6 | Correct | 7 ms | 604 KB | Output is correct |
7 | Correct | 4 ms | 604 KB | Output is correct |
8 | Correct | 4 ms | 636 KB | Output is correct |
9 | Correct | 5 ms | 640 KB | Output is correct |
10 | Correct | 8 ms | 704 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 540 KB | Output is correct |
4 | Correct | 3 ms | 540 KB | Output is correct |
5 | Correct | 4 ms | 540 KB | Output is correct |
6 | Correct | 7 ms | 604 KB | Output is correct |
7 | Correct | 4 ms | 604 KB | Output is correct |
8 | Correct | 4 ms | 636 KB | Output is correct |
9 | Correct | 5 ms | 640 KB | Output is correct |
10 | Correct | 8 ms | 704 KB | Output is correct |
11 | Execution timed out | 1071 ms | 708 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 540 KB | Output is correct |
4 | Correct | 3 ms | 540 KB | Output is correct |
5 | Correct | 4 ms | 540 KB | Output is correct |
6 | Correct | 7 ms | 604 KB | Output is correct |
7 | Correct | 4 ms | 604 KB | Output is correct |
8 | Correct | 4 ms | 636 KB | Output is correct |
9 | Correct | 5 ms | 640 KB | Output is correct |
10 | Correct | 8 ms | 704 KB | Output is correct |
11 | Execution timed out | 1071 ms | 708 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 3 ms | 540 KB | Output is correct |
4 | Correct | 3 ms | 540 KB | Output is correct |
5 | Correct | 4 ms | 540 KB | Output is correct |
6 | Correct | 7 ms | 604 KB | Output is correct |
7 | Correct | 4 ms | 604 KB | Output is correct |
8 | Correct | 4 ms | 636 KB | Output is correct |
9 | Correct | 5 ms | 640 KB | Output is correct |
10 | Correct | 8 ms | 704 KB | Output is correct |
11 | Execution timed out | 1071 ms | 708 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |