# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170765 | 2019-12-26T09:54:39 Z | songc | Naan (JOI19_naan) | C++14 | 2 ms | 408 KB |
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL,LL> pll; int N, M; bool chk[2020]; LL V[2020][2020]; pll C[2020][2020]; vector<int> P; __int128 ASDF = 11; bool comp(pll a, pll b){ return (__int128)a.first*b.second < (__int128)a.second*b.first; } int main(){ scanf("%d %d", &N, &M); for (int i=1; i<=N; i++){ LL S=0, sum=V[i][1]; for (int j=1; j<=N; j++) S += V[i][j]; int t=1; for (int j=1; j<=N; j++){ while (sum*N < S*j){ t++; sum += V[i][t]; } LL p = S*j-N*sum+V[i][t]*N*t; LL q = V[i][t] * N; C[i][j] = pll(p, q); } } for (int i=1; i<N; i++){ pll Min=pll(1234567890123456ll, 1); int k=0; for (int j=1; j<=N; j++) if (!chk[j] && comp(C[j][i], Min)) Min = C[j][i], k = j; printf("%lld %lld\n", Min.first, Min.second); P.push_back(k); chk[k] = true; } for (int x : P) printf("%d ", x); for (int i=1; i<=N; i++) if (!chk[i]) printf("%d\n", i); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Integer parameter [name=A_i] equals to 1234567890123456, violates the range [1, 2000000000000] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 408 KB | Integer parameter [name=A_i] equals to 1234567890123456, violates the range [1, 2000000000000] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Integer parameter [name=A_i] equals to 1234567890123456, violates the range [1, 2000000000000] |
2 | Halted | 0 ms | 0 KB | - |