# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
123826 | 2019-07-02T07:33:03 Z | 임유진(#3031) | Naan (JOI19_naan) | C++14 | 3 ms | 504 KB |
#include<stdio.h> #include<algorithm> #include<vector> using namespace std; #define MAXN 2005 #define FACTO 3628800 typedef long long lint; lint MULT; lint V[6][MAXN]; vector<int> P; lint X[8]; lint need[MAXN]; int main() { lint N, L; scanf("%lld%lld", &N, &L); for(int i = 0; i < N; i++) for(int j = 0; j < L; j++) scanf("%lld", &V[i][j]); MULT = FACTO * N; for(int i = 0; i < N; i++) { need[i] = 0; for(int j = 0; j < L; j++) need[i] += V[i][j] * MULT; need[i] /= N; } for(int i = 0; i < N; i++) P.push_back(i); do { bool b = true; X[0] = 0; for(int i = 0; i < N; i++) { X[i + 1] = X[i]; lint sum = 0; int k = X[i + 1] / MULT; while(X[i + 1] < L * MULT && sum + V[P[i]][k] * ((k + 1) * MULT - X[i + 1]) < need[P[i]]) { sum += V[P[i]][k] * ((k + 1) * MULT - X[i + 1]); X[i + 1] = (k + 1) * MULT; k++; } if(X[i + 1] == L * MULT && sum < need[P[i]]) { b = false; break; } X[i + 1] += (need[P[i]] - sum) / V[P[i]][k]; } if(b) { for(int i = 1; i < N; i++) printf("%lld %lld\n", X[i], MULT); for(int i = 0; i < N; i++) printf("%d ", P[i] + 1); return 0; } } while(next_permutation(P.begin(), P.end())); //printf("-1"); 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 | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 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 | 3 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 3 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 | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 356 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 3 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 376 KB | Output is correct |
18 | Correct | 3 ms | 504 KB | Output is correct |
19 | Correct | 3 ms | 380 KB | Output is correct |
20 | Correct | 3 ms | 376 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 | 2 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 | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Correct | 3 ms | 376 KB | Output is correct |
21 | Correct | 2 ms | 376 KB | Output is correct |
22 | Correct | 2 ms | 376 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 | 3 ms | 376 KB | Output is correct |
27 | Correct | 2 ms | 376 KB | Output is correct |
28 | Correct | 2 ms | 356 KB | Output is correct |
29 | Correct | 3 ms | 376 KB | Output is correct |
30 | Correct | 3 ms | 376 KB | Output is correct |
31 | Correct | 3 ms | 376 KB | Output is correct |
32 | Correct | 3 ms | 376 KB | Output is correct |
33 | Correct | 3 ms | 504 KB | Output is correct |
34 | Correct | 3 ms | 380 KB | Output is correct |
35 | Correct | 3 ms | 376 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 | 2 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 | Execution timed out | 3 ms | 504 KB | Time limit exceeded (wall clock) |
44 | Halted | 0 ms | 0 KB | - |