답안 #682331

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
682331 2023-01-16T06:30:09 Z vjudge1 푸드 코트 (JOI21_foodcourt) C++17
2 / 100
1000 ms 524288 KB
#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

using namespace std;

#define int long long
#define ll long long
#define vi vector<long long>
#define pb push_back
#define sz(s) (int)s.size()
#define all(v) v.begin(), v.end()
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define pp pair<int,int>
#define FF first
#define SS second
#define endl "\n"
#define ld long double

const int N = 1e6 + 2, N3 = 1e3 + 6, inf = 1e9 + 7, LOG = 20;
map<char, int> md{{'N', 0}, {'E', 1}, {'S', 2}, {'W', 3}};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
string stepDir = "RDLU";

int n, m, q, cnt[N];
vi v[N];

main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);

    cin >> n >> m >> q;
    for (int i = 1; i <= q; i++) {
        int t;
        cin >> t;
        if (t == 1) {
            int l, r, c, k;
            cin >> l >> r >> c >> k;
            for (int j = l; j <= r; j++) {
                for (int f = 1; f <= k; f++) {
                    v[j].pb(c);
                }
            }
        }
        else if (t == 2) {
            int l, r, k;
            cin >> l >> r >> k;
            vi a;
            for (int j = l; j <= r; j++) {
                cnt[j] += k;
                cnt[j] = min(cnt[j], sz(v[j]));
            }
        }
        else {
            int a, b;
            cin >> a >> b;
            if (b + cnt[a] > sz(v[a])) {
                cout << "0\n";
            }
            else cout << v[a][b - 1 + cnt[a]] << "\n";
        }
    }

	return 0;
}

Compilation message

foodcourt.cpp:3: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    3 | #pragma comment(linker, "/stack:200000000")
      | 
foodcourt.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   31 | main () {
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 26708 KB Output is correct
2 Correct 19 ms 29656 KB Output is correct
3 Correct 27 ms 30596 KB Output is correct
4 Correct 28 ms 36644 KB Output is correct
5 Correct 14 ms 23828 KB Output is correct
6 Correct 16 ms 23764 KB Output is correct
7 Correct 24 ms 33004 KB Output is correct
8 Correct 22 ms 32728 KB Output is correct
9 Correct 25 ms 32728 KB Output is correct
10 Correct 22 ms 33424 KB Output is correct
11 Correct 26 ms 33856 KB Output is correct
12 Correct 27 ms 33040 KB Output is correct
13 Correct 34 ms 38392 KB Output is correct
14 Correct 38 ms 39916 KB Output is correct
15 Correct 33 ms 31648 KB Output is correct
16 Correct 41 ms 39824 KB Output is correct
17 Correct 26 ms 28332 KB Output is correct
18 Correct 27 ms 30840 KB Output is correct
19 Correct 17 ms 23960 KB Output is correct
20 Correct 15 ms 23972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 26708 KB Output is correct
2 Correct 19 ms 29656 KB Output is correct
3 Correct 27 ms 30596 KB Output is correct
4 Correct 28 ms 36644 KB Output is correct
5 Correct 14 ms 23828 KB Output is correct
6 Correct 16 ms 23764 KB Output is correct
7 Correct 24 ms 33004 KB Output is correct
8 Correct 22 ms 32728 KB Output is correct
9 Correct 25 ms 32728 KB Output is correct
10 Correct 22 ms 33424 KB Output is correct
11 Correct 26 ms 33856 KB Output is correct
12 Correct 27 ms 33040 KB Output is correct
13 Correct 34 ms 38392 KB Output is correct
14 Correct 38 ms 39916 KB Output is correct
15 Correct 33 ms 31648 KB Output is correct
16 Correct 41 ms 39824 KB Output is correct
17 Correct 26 ms 28332 KB Output is correct
18 Correct 27 ms 30840 KB Output is correct
19 Correct 17 ms 23960 KB Output is correct
20 Correct 15 ms 23972 KB Output is correct
21 Runtime error 404 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 641 ms 27752 KB Output is correct
2 Correct 449 ms 28744 KB Output is correct
3 Correct 628 ms 29120 KB Output is correct
4 Correct 610 ms 29120 KB Output is correct
5 Correct 474 ms 30736 KB Output is correct
6 Correct 473 ms 30652 KB Output is correct
7 Correct 31 ms 24908 KB Output is correct
8 Correct 33 ms 25092 KB Output is correct
9 Correct 933 ms 28044 KB Output is correct
10 Correct 934 ms 28236 KB Output is correct
11 Correct 944 ms 28108 KB Output is correct
12 Execution timed out 1022 ms 28080 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 498 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 26708 KB Output is correct
2 Correct 19 ms 29656 KB Output is correct
3 Correct 27 ms 30596 KB Output is correct
4 Correct 28 ms 36644 KB Output is correct
5 Correct 14 ms 23828 KB Output is correct
6 Correct 16 ms 23764 KB Output is correct
7 Correct 24 ms 33004 KB Output is correct
8 Correct 22 ms 32728 KB Output is correct
9 Correct 25 ms 32728 KB Output is correct
10 Correct 22 ms 33424 KB Output is correct
11 Correct 26 ms 33856 KB Output is correct
12 Correct 27 ms 33040 KB Output is correct
13 Correct 34 ms 38392 KB Output is correct
14 Correct 38 ms 39916 KB Output is correct
15 Correct 33 ms 31648 KB Output is correct
16 Correct 41 ms 39824 KB Output is correct
17 Correct 26 ms 28332 KB Output is correct
18 Correct 27 ms 30840 KB Output is correct
19 Correct 17 ms 23960 KB Output is correct
20 Correct 15 ms 23972 KB Output is correct
21 Correct 641 ms 27752 KB Output is correct
22 Correct 449 ms 28744 KB Output is correct
23 Correct 628 ms 29120 KB Output is correct
24 Correct 610 ms 29120 KB Output is correct
25 Correct 474 ms 30736 KB Output is correct
26 Correct 473 ms 30652 KB Output is correct
27 Correct 31 ms 24908 KB Output is correct
28 Correct 33 ms 25092 KB Output is correct
29 Correct 933 ms 28044 KB Output is correct
30 Correct 934 ms 28236 KB Output is correct
31 Correct 944 ms 28108 KB Output is correct
32 Execution timed out 1022 ms 28080 KB Time limit exceeded
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 491 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 26708 KB Output is correct
2 Correct 19 ms 29656 KB Output is correct
3 Correct 27 ms 30596 KB Output is correct
4 Correct 28 ms 36644 KB Output is correct
5 Correct 14 ms 23828 KB Output is correct
6 Correct 16 ms 23764 KB Output is correct
7 Correct 24 ms 33004 KB Output is correct
8 Correct 22 ms 32728 KB Output is correct
9 Correct 25 ms 32728 KB Output is correct
10 Correct 22 ms 33424 KB Output is correct
11 Correct 26 ms 33856 KB Output is correct
12 Correct 27 ms 33040 KB Output is correct
13 Correct 34 ms 38392 KB Output is correct
14 Correct 38 ms 39916 KB Output is correct
15 Correct 33 ms 31648 KB Output is correct
16 Correct 41 ms 39824 KB Output is correct
17 Correct 26 ms 28332 KB Output is correct
18 Correct 27 ms 30840 KB Output is correct
19 Correct 17 ms 23960 KB Output is correct
20 Correct 15 ms 23972 KB Output is correct
21 Runtime error 404 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 26708 KB Output is correct
2 Correct 19 ms 29656 KB Output is correct
3 Correct 27 ms 30596 KB Output is correct
4 Correct 28 ms 36644 KB Output is correct
5 Correct 14 ms 23828 KB Output is correct
6 Correct 16 ms 23764 KB Output is correct
7 Correct 24 ms 33004 KB Output is correct
8 Correct 22 ms 32728 KB Output is correct
9 Correct 25 ms 32728 KB Output is correct
10 Correct 22 ms 33424 KB Output is correct
11 Correct 26 ms 33856 KB Output is correct
12 Correct 27 ms 33040 KB Output is correct
13 Correct 34 ms 38392 KB Output is correct
14 Correct 38 ms 39916 KB Output is correct
15 Correct 33 ms 31648 KB Output is correct
16 Correct 41 ms 39824 KB Output is correct
17 Correct 26 ms 28332 KB Output is correct
18 Correct 27 ms 30840 KB Output is correct
19 Correct 17 ms 23960 KB Output is correct
20 Correct 15 ms 23972 KB Output is correct
21 Runtime error 404 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -