이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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[65001];
vi v[65001];
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;
}
컴파일 시 표준 에러 (stderr) 메시지
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 () {
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |