답안 #549062

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549062 2022-04-15T04:32:57 Z Belgutei Lightning Rod (NOI18_lightningrod) C++17
14 / 100
1383 ms 92696 KB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int n;
int a,b;
map<int,int> mp;
int mx = -1;
int ans;

stack<int> s;

int main(){
    IOS
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a >> b;
        if(a + b <= mx){
            continue;
        }
        mx = max(mx,a+b);
        int val = max(a,b) - min(a,b);
        while(s.size()>0){
            if(s.top() >= val){
                s.pop();
            }
            else break;
        }
        s.push(val);
    }

    cout << s.size();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1356 ms 88484 KB Output is correct
2 Correct 1378 ms 82956 KB Output is correct
3 Correct 1289 ms 66316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1358 ms 43812 KB Output is correct
2 Correct 1349 ms 92696 KB Output is correct
3 Correct 1383 ms 87184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1356 ms 88484 KB Output is correct
2 Correct 1378 ms 82956 KB Output is correct
3 Correct 1289 ms 66316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -