답안 #427250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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';
    }
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 581 ms 1048580 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 581 ms 1048580 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -