답안 #958275

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
958275 2024-04-05T09:23:55 Z Vladth11 청소 (JOI20_sweeping) C++14
1 / 100
18000 ms 18792 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;
}

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;
      |                     ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 604 KB Output is correct
2 Correct 8 ms 492 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 21 ms 604 KB Output is correct
5 Correct 60 ms 604 KB Output is correct
6 Correct 21 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18076 ms 18792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18033 ms 18764 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 18033 ms 18764 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 604 KB Output is correct
2 Correct 8 ms 492 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 21 ms 604 KB Output is correct
5 Correct 60 ms 604 KB Output is correct
6 Correct 21 ms 348 KB Output is correct
7 Execution timed out 18076 ms 18792 KB Time limit exceeded
8 Halted 0 ms 0 KB -