QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#589270#9370. Gambling on Choosing RegionalsSGColinCompile Error//Python31.0kb2024-09-25 16:57:552024-09-25 16:57:55

Judging History

你现在查看的是最新测评结果

  • [2024-09-25 16:57:55]
  • 评测
  • [2024-09-25 16:57:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m; 
	cin >> n >> m;
    if (n < 1 || m < 1 || n > 100000 || m > 100000) cout << "???" << endl;
	int c = 1e9;
	rep(i, 1, m) {
		int cc; 
		cin >> cc; 
        if (cc < 1 || cc > 1000000000) cout << "???" << endl;
		c = min(c, cc);
	}
	map<string, int> cnt;
	vector<int> ans(n + 1, 0);
	vector<tuple<int, int, string>> s;
	rep(i, 1, n) {
		int w;
		string nam;
		cin >> w >> nam;
        if (w < 1 || w > 1000000000 || nam.size() > 10) cout << "???" << endl;
		s.eb(w, i, nam);
	}
	sort(all(s));
	reverse(all(s));
	int pre = 0, lstw = 0;
	for (auto [w, id, nam] : s) {
        if (w == lstw) cout << "???" << endl;
        lstw = w;
		ans[id] = pre + (cnt[nam] < c);
		if (cnt[nam] < c) ++pre;
		++cnt[nam];
	}
	rep(i, 1, n) printf("%d\n", ans[i]);
	return 0;
}

詳細信息

  File "answer.code", line 2
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax