Submission #942940

# Submission time Handle Problem Language Result Execution time Memory
942940 2024-03-11T07:14:03 Z guagua0407 Sweeping (JOI20_sweeping) C++17
1 / 100
18000 ms 18896 KB
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};

void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}

struct qry{
    int t,a,b;
};

const int mxn=2e6+5;
const int inf=1e9+5;
int x[mxn],y[mxn];

int main() {_
    int n,m,q;
    cin>>n>>m>>q;
    for(int i=1;i<=m;i++){
        cin>>x[i]>>y[i];
    }
    //cout<<'\n';
    for(int i=0;i<q;i++){
        int t,v;
        cin>>t>>v;
        if(t==1){
            cout<<x[v]<<' '<<y[v]<<'\n';
        }
        else if(t==2){
            for(int j=1;j<=m;j++){
                if(y[j]<=v) x[j]=max(x[j],n-v);
            }
        }
        else if(t==3){
            for(int j=1;j<=m;j++){
                if(x[j]<=v) y[j]=max(y[j],n-v);
            }
        }
        else{
            int u;
            cin>>u;
            x[++m]=v;
            y[m]=u;
        }
    }
    return 0;
}
//maybe its multiset not set
//yeeorz
//laborz

Compilation message

sweeping.cpp: In function 'void setIO(std::string)':
sweeping.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sweeping.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2652 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 2 ms 2624 KB Output is correct
4 Correct 8 ms 2652 KB Output is correct
5 Correct 22 ms 2576 KB Output is correct
6 Correct 5 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 18028 ms 17088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 18091 ms 18896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 18091 ms 18896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2652 KB Output is correct
2 Correct 3 ms 2396 KB Output is correct
3 Correct 2 ms 2624 KB Output is correct
4 Correct 8 ms 2652 KB Output is correct
5 Correct 22 ms 2576 KB Output is correct
6 Correct 5 ms 2396 KB Output is correct
7 Execution timed out 18028 ms 17088 KB Time limit exceeded
8 Halted 0 ms 0 KB -