답안 #77239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
77239 2018-09-24T07:58:56 Z farukkastamonuda Temperature (POI11_tem) C++14
91 / 100
350 ms 33792 KB
#include <bits/stdc++.h>
using namespace std;

int n, s[1000000], e[1000000], x[1000000], v[1000000], mn, c[1000000], ans, ds, de;

int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d%d", s + i, e + i);
    }
    ds = de = n;
    for(int i = 0;i < n;i++){
        int cmn = i;
        while(ds < de && s[x[ds]] < s[i]){
            cmn = min(cmn, v[x[ds]]);
            c[v[x[ds]]] = 0;
            ds++;
        }
        c[cmn] = 1;
        while(ds < de && s[x[de - 1]] > e[i]){
            de--;
            c[v[x[de]]] = 0;
            while(!c[mn]) mn++;
        }
        x[--ds] = i;
        v[i] = cmn;
        ans = max(ans, i - mn + 1);
    }
    printf("%d\n", ans);
}

Compilation message

tem.cpp: In function 'int main()':
tem.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
tem.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", s + i, e + i);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 544 KB Output is correct
2 Correct 2 ms 720 KB Output is correct
3 Correct 2 ms 728 KB Output is correct
4 Correct 2 ms 728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 792 KB Output is correct
2 Correct 5 ms 984 KB Output is correct
3 Correct 6 ms 1040 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 8168 KB Output is correct
2 Correct 115 ms 9144 KB Output is correct
3 Correct 126 ms 11032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 228 ms 12520 KB Output is correct
2 Correct 241 ms 13804 KB Output is correct
3 Correct 231 ms 14952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 290 ms 14952 KB Output is correct
2 Correct 240 ms 14952 KB Output is correct
3 Correct 303 ms 15588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 330 ms 16032 KB Output is correct
2 Correct 250 ms 17772 KB Output is correct
3 Correct 350 ms 21784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 294 ms 21784 KB Output is correct
2 Correct 234 ms 21784 KB Output is correct
3 Correct 241 ms 21784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 156 ms 21784 KB Output is correct
2 Correct 171 ms 21784 KB Output is correct
3 Correct 179 ms 21784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 169 ms 21784 KB Output is correct
2 Correct 187 ms 25000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 253 ms 25000 KB Output is correct
2 Correct 336 ms 30500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 249 ms 30500 KB Output is correct
2 Runtime error 334 ms 33792 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.