#include <bits/stdc++.h>
using namespace std;
//vector <long long> v;
//stack <long long> s, s2;
//bbbbaaaa
//queue <long long> s, s2;
long long int z[1], x[3000000][2], y[10], m, szu, wy[10][1];
//char s1[1000000], s2[1000000], c;
int war(const void*a, const void *b)
{
if(*(long long*)a>*(long long*)b)return(1);
return(0);
}
int main()
{
long long int c, d, e, f, g, i, j, q, t, k, a, n, b, w, p, aa, bb, cc, dd, nn, kk;
t=1;
//scanf("%lld", &t);
for(q=1; q<=t; q++)
{
scanf("%lld", &n);
for(i=0; i<n; i++)
{
scanf("%lld%lld%lld", &a, &b, &c);
a--;
x[b+1000000-c][a]++;
}
w=0;
for(i=0; i<2000010; i++)
{
w+=min(x[i][0], x[i][1]);
}
printf("%lld\n", w);
}
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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #include <bits/stdc++.h> using namespace std; //vector <long long> v; //stack <long long> s, s2; //bbbbaaaa //queue <long long> s, s2; long long int z[1], x[3000000][2], y[10], m, szu, wy[10][1]; //char s1[1000000], s2[1000000], c; int war(const void*a, const void *b) { if(*(long long*)a>*(long long*)b)return(1); return(0); } int main() { long long int c, d, e, f, g, i, j, q, t, k, a, n, b, w, p, aa, bb, cc, dd, nn, kk; t=1; //scanf("%lld", &t); for(q=1; q<=t; q++) { scanf("%lld", &n); for(i=0; i<n; i++) { scanf("%lld%lld%lld", &a, &b, &c); a--; x[b+1000000-c][a]++; } w=0; for(i=0; i<2000010; i++) { w+=min(x[i][0], x[i][1]); } printf("%lld\n", w); } return(0); } |
English