답안 #237230

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237230 2020-06-05T10:29:14 Z DIvanCode Hokej (COCI17_hokej) C++14
0 / 120
253 ms 7928 KB
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<queue>
#include<ctime>
#include<cassert>
#include<complex>
#include<string>
#include<cstring>
#include<chrono>
#include<random>
#include<bitset>
#include<iomanip>

#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()

using namespace std;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int MAX_N = 5e5 + 5;

int m, n;
pii a[MAX_N];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> m >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i].fi >> a[i].se;
	}
	vector<int> order(n);
	iota(all(order), 1);
	sort(all(order), [&](int i, int j) {
		return 1ll * a[i].fi * a[j].se < 1ll * a[i].se * a[i].fi;
	});
	vector<int> now_playing;
	int j = 6, sum = 0;
	for (int i = 0; i < 6; ++i) {
		now_playing.eb(order[i]);
		sum += a[order[i]].fi;
	}
	ll ans = 0;
	vector<pair<int, pii>> subst;
	for (int i = 1; i <= m; ++i) {
		ans += sum;
		if (i == m) {
			break;
		}
		vector<int> new_playing;
		for (int x : now_playing) {
			--a[x].se;
			if (!a[x].se) {
				sum -= a[x].fi;
				new_playing.eb(order[j]);
				sum += a[order[j]].fi;
				subst.eb(i, mp(x, order[j]));
				++j;
			} else {
				new_playing.eb(x);
			}
		}
		now_playing.swap(new_playing);
	}
	cout << ans << "\n";
	for (int i = 0; i < 6; ++i) {
		cout << order[i] << " ";
	}
	cout << "\n" << sz(subst) << "\n";
	for (auto &pp : subst) {
		cout << pp.fi << " " << pp.se.fi << " " << pp.se.se << "\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Incorrect 7 ms 512 KB Output isn't correct
3 Failed 111 ms 896 KB CONTESTANT FOUND BETTER ANSWER THAN JURY
4 Incorrect 5 ms 384 KB Output isn't correct
5 Incorrect 49 ms 640 KB Output isn't correct
6 Incorrect 6 ms 512 KB Output isn't correct
7 Incorrect 7 ms 512 KB Output isn't correct
8 Incorrect 40 ms 2304 KB Output isn't correct
9 Failed 251 ms 7928 KB CONTESTANT FOUND BETTER ANSWER THAN JURY
10 Failed 253 ms 7920 KB CONTESTANT FOUND BETTER ANSWER THAN JURY