답안 #237218

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237218 2020-06-05T09:29:11 Z DIvanCode Hokej (COCI17_hokej) C++14
48 / 120
267 ms 6788 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 a[i] > a[j];
	});
	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 Correct 5 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 100 ms 640 KB Output is correct
4 Incorrect 6 ms 384 KB Output isn't correct
5 Correct 44 ms 512 KB Output is correct
6 Incorrect 6 ms 512 KB Output isn't correct
7 Incorrect 7 ms 512 KB Output isn't correct
8 Incorrect 43 ms 1912 KB Output isn't correct
9 Incorrect 267 ms 6648 KB Output isn't correct
10 Incorrect 266 ms 6788 KB Output isn't correct