# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396424 | Blondie | Aliens (IOI16_aliens) | C++17 | 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;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
#define F first
#define S second
const int MOD = 1e9 + 7;//XXX
const int C = 26;//XXX
void add(int &x, int y){
x += y;
while (x >= MOD) x -= MOD;
while (x < 0) x += MOD;
}
int fix(int x){
while (x >= MOD) x -= MOD;
while (x < 0) x += MOD;
return x;
}
int pw(int a, int b){
int ret = 1;
while (b){
if (b & 1)
ret = 1ll*ret*a%MOD;
b >>= 1;
a = 1ll*a*a%MOD;
}
return ret;
}
const int MAXN = 1e2 + 10;
int n, m, k;
int a[MAXN][MAXN];
void solve() {
cin >> n >> m >> k;
assert(n <= 50 && m <= 100 && k == n);
for(int i = 0; i < n; i++) {
int r, c; cin >> r >> c;
if(r > c)
swap(r, c);
int len = c-r+1;
for(int row = r; row < r+len; row++) {
for(int col = r; col < r+len; col++) {
a[row][col] = 1;
}
}
}
int answer = 0;
for(int i = 0; i < m; i++) {
for(int j = 0; j < m; j++) {
cerr << a[i][j] << " ";
answer += a[i][j];
}
cerr << "\n";
}
cout << answer << "\n";
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
//cout << fixed << setprecision(6);
int te = 1;
//cin >> te;
for (int w = 1; w <= te; w++){
//cout << "Case #" << w << ": ";
solve();
}
return 0;
}