답안 #631869

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
631869 2022-08-19T03:42:42 Z jhnah917 Interval Collection (CCO20_day2problem2) C++14
0 / 25
420 ms 55996 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    set<pair<int,int>> S;
    multiset<int> R;
    for(int i=1; i<=N; i++){
        char op; int s, e; cin >> op >> s >> e;
        if(op == 'A'){
            auto it = S.emplace(s, e).first;
            if(it != S.begin() && next(it) != S.end()){
                R.erase(R.find(next(it)->second - prev(it)->first));
            }
            if(it != S.begin()) R.insert(e - prev(it)->first);
            if(next(it) != S.end()) R.insert(next(it)->second - s);
        }
        else{
            auto it = S.erase(S.find(make_pair(s, e)));
            if(it != S.end()) R.erase(it->second - s);
            if(it != S.begin()) R.erase(e - prev(it)->first);
            if(it != S.begin() && it != S.end()) R.insert(it->second - prev(it)->first);
        }
        if(R.empty()) cout << S.begin()->second - S.begin()->first << "\n";
        else cout << *R.begin() << "\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 158 ms 22540 KB Output is correct
2 Correct 153 ms 22580 KB Output is correct
3 Correct 327 ms 44896 KB Output is correct
4 Correct 278 ms 44860 KB Output is correct
5 Correct 420 ms 55996 KB Output is correct
6 Correct 356 ms 55876 KB Output is correct
7 Runtime error 1 ms 468 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -