/ CYOJ /

记录详情

Accepted


  
Found 5 testcases.
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Accepted 1ms 256.0 KiB
#2 Accepted 1ms 256.0 KiB
#3 Accepted 1ms 256.0 KiB
#4 Accepted 2ms 256.0 KiB
#5 Accepted 1ms 256.0 KiB

代码

#include<bits/stdc++.h>
using namespace std;
long long a,b,c;
long long ans; 
int g[10000][3];  
int ge = 0;
void find(int d,int e,int f) {
	for(int j = 1;j <= ge;j++) {
		if(g[ge][0] == d and g[ge][1] == e) {
			if(g[ge][2] != 0 and f == 0) {
				g[ge][2] = 0;
				ans++;
			}
			if(g[ge][2] == 0 and f != 0) {
				g[ge][2] = f;
				ans--;
			}
			return;
		}
	}
	if(f == 0)return;
	ge++;
	ans--;
	g[ge][0] = d;
	g[ge][1] = e;
	g[ge][2] = f;
}
int main() {
	cin>>a>>b>>c;
	ans = a * b;
	for(int i = 1;i <= c;i++) {
		int d,e,f;
		cin>>d>>e>>f;
		find(d,e,f);
	}
	cout<<ans;
}

信息

递交者
类型
递交
题目
P1015 (出题团2022年7-8月)柜子
语言
C++
递交时间
2022-09-02 21:51:34
评测时间
2022-09-02 21:51:34
评测机
分数
100
总耗时
8ms
峰值内存
256.0 KiB