# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
171660 | 2019-12-29T13:54:18 Z | dennisstar | Naan (JOI19_naan) | C++11 | 849 ms | 118364 KB |
#include <bits/stdc++.h> #define fi first #define se second #define ryan bear #define all(V) ((V).begin()), ((V).end()) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; typedef vector<int> vim; typedef vector<ll> vlm; int N, L; int chk[2010]; ll V[2010][2010], S[2010]; vector<pll> ar[2010]; vim ans; bool cmp(pll a, pll b) {return (__int128)a.fi*b.se<(__int128)b.fi*a.se;} int main() { scanf("%d %d", &N, &L); for (int i=1; i<=N; i++) for (int j=1; j<=L; j++) { scanf("%lld", &V[i][j]); V[i][j]*=N; S[i]+=V[i][j]; } ll s; for (int i=1; i<=N; i++) { s=0; for (int j=1, k=1; j<=L; j++) { s+=V[i][j]; while (k<=N && k*(S[i]/N)<=s) { ar[i].push_back({(j-1)*V[i][j]+k*(S[i]/N)-(s-V[i][j]) , V[i][j]}); k++; } } } pll mn={0, 1}; int mi; for (int i=1; i<=N; i++) { mn={1000000, 1}; for (int j=1; j<=N; j++) { if (chk[j]) continue; if (cmp(ar[j][i-1], mn)) mn=ar[j][i-1], mi=j; } if (i<N) printf("%lld %lld\n", mn.fi, mn.se); ans.push_back(mi); chk[mi]=1; } for (int i:ans) printf("%d ", i); puts(""); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 380 KB | Output is correct |
4 | Correct | 3 ms | 504 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 3 ms | 504 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 3 ms | 504 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 504 KB | Output is correct |
15 | Correct | 3 ms | 504 KB | Output is correct |
16 | Correct | 4 ms | 476 KB | Output is correct |
17 | Correct | 3 ms | 632 KB | Output is correct |
18 | Correct | 3 ms | 504 KB | Output is correct |
19 | Correct | 4 ms | 632 KB | Output is correct |
20 | Correct | 3 ms | 504 KB | Output is correct |
21 | Correct | 3 ms | 504 KB | Output is correct |
22 | Correct | 3 ms | 504 KB | Output is correct |
23 | Correct | 2 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 376 KB | Output is correct |
25 | Correct | 3 ms | 376 KB | Output is correct |
26 | Correct | 2 ms | 376 KB | Output is correct |
27 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 376 KB | Output is correct |
18 | Correct | 3 ms | 380 KB | Output is correct |
19 | Correct | 3 ms | 504 KB | Output is correct |
20 | Correct | 3 ms | 504 KB | Output is correct |
21 | Correct | 3 ms | 504 KB | Output is correct |
22 | Correct | 3 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 504 KB | Output is correct |
25 | Correct | 3 ms | 504 KB | Output is correct |
26 | Correct | 3 ms | 504 KB | Output is correct |
27 | Correct | 2 ms | 376 KB | Output is correct |
28 | Correct | 3 ms | 376 KB | Output is correct |
29 | Correct | 3 ms | 504 KB | Output is correct |
30 | Correct | 3 ms | 504 KB | Output is correct |
31 | Correct | 4 ms | 476 KB | Output is correct |
32 | Correct | 3 ms | 632 KB | Output is correct |
33 | Correct | 3 ms | 504 KB | Output is correct |
34 | Correct | 4 ms | 632 KB | Output is correct |
35 | Correct | 3 ms | 504 KB | Output is correct |
36 | Correct | 3 ms | 504 KB | Output is correct |
37 | Correct | 3 ms | 504 KB | Output is correct |
38 | Correct | 2 ms | 376 KB | Output is correct |
39 | Correct | 3 ms | 376 KB | Output is correct |
40 | Correct | 3 ms | 376 KB | Output is correct |
41 | Correct | 2 ms | 376 KB | Output is correct |
42 | Correct | 3 ms | 376 KB | Output is correct |
43 | Correct | 64 ms | 11896 KB | Output is correct |
44 | Correct | 379 ms | 54192 KB | Output is correct |
45 | Correct | 243 ms | 29000 KB | Output is correct |
46 | Correct | 34 ms | 3704 KB | Output is correct |
47 | Correct | 279 ms | 39416 KB | Output is correct |
48 | Correct | 249 ms | 76792 KB | Output is correct |
49 | Correct | 94 ms | 22776 KB | Output is correct |
50 | Correct | 464 ms | 97188 KB | Output is correct |
51 | Correct | 243 ms | 41720 KB | Output is correct |
52 | Correct | 493 ms | 87140 KB | Output is correct |
53 | Correct | 383 ms | 81220 KB | Output is correct |
54 | Correct | 3 ms | 504 KB | Output is correct |
55 | Correct | 111 ms | 44408 KB | Output is correct |
56 | Correct | 314 ms | 56576 KB | Output is correct |
57 | Correct | 252 ms | 49328 KB | Output is correct |
58 | Correct | 345 ms | 78804 KB | Output is correct |
59 | Correct | 286 ms | 46420 KB | Output is correct |
60 | Correct | 787 ms | 118028 KB | Output is correct |
61 | Correct | 849 ms | 118044 KB | Output is correct |
62 | Correct | 789 ms | 117708 KB | Output is correct |
63 | Correct | 793 ms | 118364 KB | Output is correct |
64 | Correct | 766 ms | 118136 KB | Output is correct |
65 | Correct | 607 ms | 104824 KB | Output is correct |
66 | Correct | 610 ms | 104856 KB | Output is correct |
67 | Correct | 615 ms | 104788 KB | Output is correct |
68 | Correct | 298 ms | 60408 KB | Output is correct |
69 | Correct | 349 ms | 56628 KB | Output is correct |
70 | Correct | 337 ms | 72188 KB | Output is correct |
71 | Correct | 523 ms | 82364 KB | Output is correct |