# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
57434 | daniel060811 | 줄서기 (KOI17_line) | C++98 | 1087 ms | 596 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |