QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#575860#9303. Message Bomblongyin#Compile Error//C++17762b2024-09-19 17:04:012024-09-19 17:04:02

Judging History

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

  • [2024-09-19 17:04:02]
  • 评测
  • [2024-09-19 17:04:01]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;

const int N = 1e6 + 5;

int p[N];
int cnt[N];
set<int> s[N];

void solve() {
	int n, m, s;
	cin >> n >> m >> s;
	for (int i = 1; i <= s; i++) {
		int t, x, y;
		cin >> t >> x >> y;
		if (t == 1) {
			cnt[x] -= p[y];
			s[y].insert(x);
		}
		else if (t == 2) {
			cnt[x] += p[y];
			s[y].erase(x);
		}	
		else {
			p[y]++;
			cnt[x]--;
		}
	}
	for (int i = 1; i <= m; i++) {
		for (int x : s[i]) {
			cnt[x] += p[i];
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << cnt[i] << endl;
	}
}

signed main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int T = 1;
	cin >> T;
	
	while (T--) {
		solve();
	}
	
	return 0;
}

详细

answer.code: In function ‘void solve()’:
answer.code:20:26: error: invalid types ‘long long int[long long int]’ for array subscript
   20 |                         s[y].insert(x);
      |                          ^
answer.code:24:26: error: invalid types ‘long long int[long long int]’ for array subscript
   24 |                         s[y].erase(x);
      |                          ^
answer.code:32:31: error: invalid types ‘long long int[long long int]’ for array subscript
   32 |                 for (int x : s[i]) {
      |                               ^