Submission #375418

# Submission time Handle Problem Language Result Execution time Memory
375418 2021-03-09T11:05:57 Z casperwang Naan (JOI19_naan) C++14
0 / 100
1 ms 364 KB
#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 = 1e9;
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 time Memory Grader output
1 Incorrect 1 ms 364 KB Not a fair distribution.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Not a fair distribution.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Not a fair distribution.
2 Halted 0 ms 0 KB -