Submission #958274

# Submission time Handle Problem Language Result Execution time Memory
958274 2024-04-05T09:23:07 Z Vladth11 Sweeping (JOI20_sweeping) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")

#define int ll

using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;

const ll NMAX = 500001;
const ll INF = 1e9;
const ll nrbits = 20;
const ll MOD = 998244353;

signed main() {
#ifdef HOME
    ifstream cin(".in");
    ofstream cout(".out");
#endif // HOME
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    vector <pii> v;
    int n, m, q, i, oke = 1;
    cin >> n >> m >> q;
    for(i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        if(v.size() && (a < v.back().first || b > v.back().second)){
            oke = 0;
        }
        v.push_back({a, b});
    }
        while(q--) {
            int t;
            cin >> t;
            if(t == 4) {
                int a, b;
                cin >> a >> b;
                v.push_back({a, b});
            } else if(t == 1) {
                int x;
                cin >> x;
                cout << v[x - 1].first << " " << v[x - 1].second << "\n";
            } else if(t == 2) {
                int l;
                cin >> l;
                for(auto &x : v) {
                    if(x.second <= l)
                        x.first = max(x.first, n - l);
                }
            } else {
                int l;
                cin >> l;
                for(auto &x : v) {
                    if(x.first <= l)
                        x.second = max(x.second, n - l);
                }
            }
        }
        return 0;
    }
    if(oke == 1){
        build(1, 1, m);
        for(int i = 1; i <= q; i++){
            int t;
            cin >> t;
            if(t == 1){
                pii x = afla(1, 1, m, i);
                cout << x.first << " " << x.second << "\n";
            }else if(t == 2){
                int unde = searchY(l);
                if(l >= 1)
                    addMaximX(1, 1, n, 1, l);
            }else{
                int unde = searchX(l);
                if(l >= 1)
                    addMaximY(1, 1, n, 1, l);
            }
        }
        return 0;
}

Compilation message

sweeping.cpp: In function 'int main()':
sweeping.cpp:27:21: warning: variable 'oke' set but not used [-Wunused-but-set-variable]
   27 |     int n, m, q, i, oke = 1;
      |                     ^~~
sweeping.cpp: At global scope:
sweeping.cpp:66:5: error: expected unqualified-id before 'if'
   66 |     if(oke == 1){
      |     ^~