| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1366682 | makon | Second Run (KAISTRUN26SPRING_A) | Pypy 3 | 297 ms | 288624 KiB |
import sys
input = sys.stdin.readline
def main():
N, M = map(int, input().split())
k = [0] * M
cur_sum = [0] * M
rem = [4] * M
adj = [[] for _ in range(N + 1)]
for idx in range(M):
x, y, z, w, kk = map(int, input().split())
k[idx] = kk
adj[x].append(idx)
adj[y].append(idx)
adj[z].append(idx)
adj[w].append(idx)
ans = [0] * (N + 1)
for i in range(1, N + 1):
cnt = [0, 0, 0, 0]
for cid in adj[i]:
if rem[cid] == 1:
need = (k[cid] - cur_sum[cid]) & 3
cnt[need] += 1
best = 0
for v in range(1, 4):
if cnt[v] > cnt[best]:
best = v
ans[i] = best
for cid in adj[i]:
rem[cid] -= 1
cur_sum[cid] = (cur_sum[cid] + best) & 3
print(*ans[1:])
if __name__ == "__main__": main()Compilation message (stdout)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
