Submission #427426

#TimeUsernameProblemLanguageResultExecution timeMemory
4274262qbingxuanAliens (IOI16_aliens)C++14
4 / 100
1 ms688 KiB
#include "aliens.h"
#include <bits/stdc++.h>
#ifdef local
#define debug(x...) qqbx(#x, x)
#define pary(x...) danb(#x, x)
#define safe std::cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
template <typename ...T> void qqbx(const char *s, T ...a) {
    int cnt = sizeof...(T);
    ((std::cerr << "\e[1;32m(" << s << ") = ("), ..., (std::cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename T> void danb(const char *s, T L, T R) {
    std::cerr << "\e[1;32m[ " << s << " ] = [ ";
    for (int f = 0; L != R; ++L)
        std::cerr << (f++ ? ", " : "") << *L;
    std::cerr << " ]\e[0m\n";
}
#else
#define debug(...) ((void)0)
#define pary(...) ((void)0)
#define safe ((void)0)
#endif // local
#define all(v) begin(v),end(v)

using namespace std;
using ll = long long;
const ll INF = 1e18;
const int maxn = 1025;
int pre[maxn][maxn];
long long take_photos(int n, int m, int k, std::vector<int> row, std::vector<int> col) {
    for (int i = 0; i < n; i++) {
        int l = row[i], r = col[i];
        if (l > r) swap(l, r);
        ++r;
        pre[l][l] += 1;
        pre[l][r] -= 1;
        pre[r][l] -= 1;
        pre[r][r] += 1;
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
            if (i) pre[i][j] += pre[i-1][j];
            if (j) pre[i][j] += pre[i][j-1];
            if (i && j) pre[i][j] -= pre[i-1][j-1];
        }
    }
    int ans = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < m; j++) {
            if (pre[i][j])
                ++ans;
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...