#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
const long long MAXN = 7e4+10;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
long long n, m, q;
long long t[MAXN * 4];
vector < pair < long long/**number*/, long long/**colour*/> > g[MAXN];
vector < long long > pref[MAXN];
long long cutted[MAXN];
void solve()
{
cin >> n >> m >> q;
long long type, l, r, k, c;
for (long long i = 1; i <= n; ++ i)
{
pref[i].push_back(0);
g[i].push_back({0, 0});
}
long long aa, bb;
for (long long i = 1; i <= q; ++ i)
{
cin >> type;
if(type == 1)
{
cin >> l >> r >> c >> k;
for (long long j = l; j <= r; ++ j)
{
g[j].push_back(make_pair(k, c));
pref[j].push_back(pref[j].back()+k);
}
}
else if(type == 2)
{
cin >> l >> r >> k;
for (long long j = l; j <= r; ++ j)
cutted[j] += min(pref[j].back(), k);
}
else
{
cin >> aa >> bb;
/// cout << "* " << cutted[aa] << " " << endl;
long long l = 0, r = pref[aa].size()-1, mid, ans = 0;
while(l <= r)
{
mid = (l + r)/2;
if(pref[aa][mid] < bb + cutted[aa])
{
l = mid + 1;
}
else
{
ans = mid;
r = mid - 1;
}
}
cout << g[aa][ans].second << endl;
}
}
}
int main()
{
speed();
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
12892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
12892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1049 ms |
14164 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
17756 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
12892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
448 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
12892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
12892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |