Submission #427250

# Submission time Handle Problem Language Result Execution time Memory
427250 2021-06-14T13:48:14 Z model_code Posters on the wall (CPSPC17_posters) C++17
10 / 100
3500 ms 1048580 KB
#include<bits/stdc++.h>

using namespace std;

#define mp(x,y) make_pair(x, y)
#define For(i, n) for (int i = 0; i < (int) n; i++)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;

int main () {
    ll r, c, n, q, MOD;
    cin >> r >> c >> n >> q >> MOD;
    vector<vector<bool> > plane(r, vector<bool>(c, false));

    For(i, n) {
        ll x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if (x1 > x2) swap(x1, x2);
        if (y1 > y2) swap(y1, y2);

        for (int ir = x1; ir < x2; ir ++) {
            for (int ic = y1; ic < y2; ic ++) {
                if (plane [ir][ic]) {
                    cerr << "BAD INPUT! " << ir << ' ' << ic << "\n";
                    exit(1);
                }
                plane [ir][ic] = true;
            }
        }
    }

/*    For(i, r) {
        For(j, c) {
            cout << plane [i][j];
        }
        cout << '\n';
    }*/

    ll lastres = 0;
    For(magic, q) {
        ll x1, y1, x2, y2, mod;
        cin >> x1 >> y1 >> x2 >> y2 >> mod;
        
        mod = ((lastres % MOD) * mod) % MOD;
        x1 = (x1 + mod) % MOD;
        x2 = (x2 + mod) % MOD;
        y1 = (y1 + mod) % MOD;
        y2 = (y2 + mod) % MOD;

        if (x1 > x2) swap(x1, x2);
        if (y1 > y2) swap(y1, y2);

        lastres = 0;
        for (int ir = x1; ir < x2; ir ++){
            for (int ic = y1; ic < y2; ic ++) {
                if (plane [ir][ic]) lastres ++;
            }
        }
        cout << lastres << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 13 ms 332 KB Output is correct
3 Correct 13 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 13 ms 332 KB Output is correct
3 Correct 13 ms 332 KB Output is correct
4 Execution timed out 3516 ms 3624 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 13 ms 332 KB Output is correct
3 Correct 13 ms 332 KB Output is correct
4 Execution timed out 3516 ms 3624 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 13 ms 332 KB Output is correct
3 Correct 13 ms 332 KB Output is correct
4 Execution timed out 3516 ms 3624 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 13 ms 332 KB Output is correct
3 Correct 13 ms 332 KB Output is correct
4 Execution timed out 3516 ms 3624 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 581 ms 1048580 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 581 ms 1048580 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -