제출 #375420

#제출 시각아이디문제언어결과실행 시간메모리
375420casperwangNaan (JOI19_naan)C++14
0 / 100
1 ms364 KiB
#include <bits/stdc++.h> #define pii pair<int,int> #define pdi pair<double,int> #define ff first #define ss second using namespace std; #define debug(args...) kout("[ " + string(#args) + " ]", args) void kout() { cerr << endl; } template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); } template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; } const int MAXN = 2000; const int INF = 1e4; const double eps = 1e-9; int n, L; int v[MAXN+1][MAXN+1]; int sum[MAXN+1]; double now; int p[MAXN+1]; pii ans[MAXN]; signed main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> n >> L; for (int i = 1; i <= n; i++) { for (int j = 1; j <= L; j++) { cin >> v[i][j]; sum[i] += v[i][j]; } } for (int i = 1; i <= n; i++) { pdi mmin(INF, 0); for (int j = 1; j <= n; j++) { double s = 0, k = (double) sum[j] / n; while (true) { int id = ceil(now + eps); if ((id - now) * v[j][id] + s >= k) { mmin = min(mmin, pdi(now + (k - s) / v[j][id], j)); break; } else { s += (id - now) * v[j][id]; } } } p[i] = mmin.ss; now = mmin.ff; if (i < n) ans[i] = pii(now * INF, INF); } for (int i = 1; i < n; i++) cout << ans[i].ff << ' ' << ans[i].ss << '\n'; for (int i = 1; i <= n; i++) cout << p[i] << " \n"[i==n]; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...