Submission #544683

#TimeUsernameProblemLanguageResultExecution timeMemory
544683pokmui9909줄서기 (KOI17_line)C++17
100 / 100
193 ms12828 KiB
#include <bits/stdc++.h> using namespace std; int A[100005]; int chk[100005]; int n, m; signed main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); cin >> n >> m; for (int i = 1; i <= n; i++) A[i] = i; for (int i = 1; i <= m; i++) { int a, b; cin >> a >> b; A[a]++, A[b]--; } for (int i = 1; i <= n; i++) { if (A[i] <= 0 || A[i] > n || chk[A[i]]) { cout << -1; return 0; } chk[A[i]] = 1; } for (int i = 1; i <= n; i++) cout << A[i] << ' '; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...