# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
617179 |
2022-08-01T09:21:18 Z |
조영욱(#8505) |
청소 (JOI20_sweeping) |
C++17 |
|
18000 ms |
22960 KB |
#include <bits/stdc++.h>
using namespace std;
const int sz=524288;
const int INF=1e9+7;
bool flag=false;
struct Seg {
int seg[sz*2];
int lazy[sz*2];
void init() {
for(int i=1;i<sz*2;i++) {
seg[i]=-INF;
lazy[i]=-INF;
}
}
void prop(int node) {
if (lazy[node]!=-INF) {
seg[node]=max(seg[node],lazy[node]);
if (node<sz) {
lazy[node*2]=max(lazy[node*2],lazy[node]);
lazy[node*2+1]=max(lazy[node*2+1],lazy[node]);
}
lazy[node]=-INF;
}
}
int sum(int l,int r,int node=1,int nodel=0,int noder=sz-1) {
prop(node);
if (r<nodel||l>noder) {
return -INF;
}
if (l<=nodel&&noder<=r) {
return seg[node];
}
int mid=(nodel+noder)/2;
return max(sum(l,r,node*2,nodel,mid),sum(l,r,node*2+1,mid+1,noder));
}
void upd(int l,int r,int val,int node=1,int nodel=0,int noder=sz-1) {
prop(node);
if (r<nodel||l>noder) {
return;
}
if (l<=nodel&&noder<=r) {
lazy[node]=max(lazy[node],val);
prop(node);
return;
}
int mid=(nodel+noder)/2;
upd(l,r,val,node*2,nodel,mid);
upd(l,r,val,node*2+1,mid+1,noder);
seg[node]=max(seg[node*2],seg[node*2+1]);
}
};
int n,m,q;
Seg seg1; //x��ǥ
Seg seg2; //y��ǥ
typedef pair<int,int> P;
vector<P> vec;
int main(void) {
scanf("%d %d %d",&n,&m,&q);
seg1.init();
seg2.init();
for(int i=0;i<m;i++) {
int x,y;
scanf("%d %d",&x,&y);
vec.push_back(P(x,y));
}
for(int i=0;i<q;i++) {
int type;
scanf("%d",&type);
if (type==1) {
int p;
scanf("%d",&p);
p--;
printf("%d %d\n",vec[p].first,vec[p].second);
}
if (type==2) {
int l;
scanf("%d",&l);
for(int j=0;j<vec.size();j++) {
if (vec[j].second<=l) {
vec[j].first=max(vec[j].first,n-l);
}
}
}
if (type==3) {
int l;
scanf("%d",&l);
for(int j=0;j<vec.size();j++) {
if (vec[j].first<=l) {
vec[j].second=max(vec[j].second,n-l);
}
}
}
if (type==4) {
int a,b;
scanf("%d %d",&a,&b);
vec.push_back(P(a,b));
}
}
}
Compilation message
sweeping.cpp: In function 'int main()':
sweeping.cpp:82:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
82 | for(int j=0;j<vec.size();j++) {
| ~^~~~~~~~~~~
sweeping.cpp:91:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
91 | for(int j=0;j<vec.size();j++) {
| ~^~~~~~~~~~~
sweeping.cpp:62:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
62 | scanf("%d %d %d",&n,&m,&q);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
sweeping.cpp:67:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
67 | scanf("%d %d",&x,&y);
| ~~~~~^~~~~~~~~~~~~~~
sweeping.cpp:72:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
72 | scanf("%d",&type);
| ~~~~~^~~~~~~~~~~~
sweeping.cpp:75:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
75 | scanf("%d",&p);
| ~~~~~^~~~~~~~~
sweeping.cpp:81:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
81 | scanf("%d",&l);
| ~~~~~^~~~~~~~~
sweeping.cpp:90:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
90 | scanf("%d",&l);
| ~~~~~^~~~~~~~~
sweeping.cpp:99:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
99 | scanf("%d %d",&a,&b);
| ~~~~~^~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
16788 KB |
Output is correct |
2 |
Correct |
21 ms |
16804 KB |
Output is correct |
3 |
Correct |
17 ms |
16768 KB |
Output is correct |
4 |
Correct |
19 ms |
16856 KB |
Output is correct |
5 |
Correct |
39 ms |
16808 KB |
Output is correct |
6 |
Correct |
15 ms |
16724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
18046 ms |
21080 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
18102 ms |
22960 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
18102 ms |
22960 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
16788 KB |
Output is correct |
2 |
Correct |
21 ms |
16804 KB |
Output is correct |
3 |
Correct |
17 ms |
16768 KB |
Output is correct |
4 |
Correct |
19 ms |
16856 KB |
Output is correct |
5 |
Correct |
39 ms |
16808 KB |
Output is correct |
6 |
Correct |
15 ms |
16724 KB |
Output is correct |
7 |
Execution timed out |
18046 ms |
21080 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |