# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
279334 | 1723191831 | Aliens (IOI16_aliens) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int maxn=100005;
const int maxm=1000005;
int r[maxn],c[maxn];
int n,m,k;
int tag[105][105];
long long int ans;
int main(){
scanf("%d%d%d",&n,&m,&k);
for(int i=0;i<n;i++)
scanf("%d%d",&r[i],&c[i]);
for(int i=0;i<k;i++)
{
for(int j=min(r[i],c[i]);max(r[i],c[i]);j++)
for(int jj=min(r[i],c[i]);jj<=c[i];jj++)
tag[j][jj]=1;
}
for(int i=0;i<m;i++)
{
for(int j=0;j<m;j++)
if(tag[i][j])ans++;
}
cout<<ans;
return 0;
}