답안 #224539

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
224539 2020-04-18T10:57:41 Z kgt Temperature (POI11_tem) C++14
8 / 100
305 ms 10872 KB
# include <bits/stdc++.h>
using namespace std;



int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    long long x;
    cin >> x;
    long long a;
    long long b;
    long long min;
    long long max;
    long long counter = 0;
    long long result = 0;
    bool change = false;

    for (long long i=0; i<x; i++){
       
        cin >> a >> b;
        if (counter == 0){
            min = a;
            max = b;
            counter ++;
            result = 1;

        } else if (b >= min) {
            if (a >= min){
                min = a;
            }
            max = b;
            counter ++;
            if (!change){
                result ++;
                continue;
            }

        } else if (b < min) {
            min = a;
            max = b;
            change = true;
            if (counter > result){
                result = counter;
                counter = 1;
                continue;
            } else {
                counter = 1;
                continue;
            }
        }

        if (counter > result) {
            result = counter;
        }

    }
  
    cout << result;
    return 0;
}

Compilation message

tem.cpp: In function 'int main()':
tem.cpp:14:15: warning: variable 'max' set but not used [-Wunused-but-set-variable]
     long long max;
               ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 452 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Incorrect 7 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 3320 KB Output is correct
2 Correct 70 ms 3960 KB Output is correct
3 Incorrect 79 ms 4216 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 195 ms 10860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 236 ms 10848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 263 ms 1016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 246 ms 6392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 110 ms 5624 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 111 ms 5448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 221 ms 10748 KB Output is correct
2 Incorrect 305 ms 980 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 215 ms 10872 KB Output isn't correct
2 Halted 0 ms 0 KB -