#include<bits/stdc++.h>
#define ll long long
using namespace std;
int sum[2][2000009];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, r, w, t;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> r >> w >> t;
sum[r-1][w+(1000000-t)]++;
}
int cnt = 0;
for(int i = 0; i < 2000007; i++)
cnt += min(sum[0][i], sum[1][i]);
cout << cnt << "\n";
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include<bits/stdc++.h> #define ll long long using namespace std; int sum[2][2000009]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, r, w, t; cin >> n; for(int i = 0; i < n; i++) { cin >> r >> w >> t; sum[r-1][w+(1000000-t)]++; } int cnt = 0; for(int i = 0; i < 2000007; i++) cnt += min(sum[0][i], sum[1][i]); cout << cnt << "\n"; return 0; } |
English