# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
814507 | 2023-08-08T08:02:37 Z | 반딧불(#10119) | Arranging Tickets (JOI17_arranging_tickets) | C++17 | 0 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, k; int ex[302], ey[302], ew[302]; int arr[302]; int ans = 1e9; int main(){ scanf("%d %d", &n, &k); for(int i=1; i<=k; i++){ scanf("%d %d %d", &ex[i], &ey[i], &ew[i]); } while(1){ for(int i=1; i<=n; i++) arr[i] = 0; for(int i=1; i<=k; i++) for(int j=ex[i]; j!=ey[i]; j=j%n+1) arr[j]++; int maxX = max_element(arr+1, arr+n+1) - arr; int MN = INT_MAX, MNX = -1; for(int i=1; i<=k; i++){ if((ex[i] <= maxX && maxX < ey[i]) || (ey[i] < ex[i] && (ex[i] <= maxX || maxX < ey[i]))){ int MX = 0; for(int j=ey[i]; j!=ex[i]; j=j%n+1) MX = max(MX, arr[j]+1); if(MX < arr[maxX] && MN > MX) MN = MX, MNX = i; } } if(MNX == -1) break; swap(ex[MNX], ey[MNX]); } ans = *max_element(arr+1, arr+n+1); printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |