Submission #223029

# Submission time Handle Problem Language Result Execution time Memory
223029 2020-04-14T13:59:49 Z AlifSaddid Temperature (POI11_tem) C++17
0 / 100
1000 ms 17784 KB
#include <bits/stdc++.h>

using namespace std;

int n;
int a[1000005], b[1000005];

bool gakTurun(int a1, int a2, int b1, int b2){
    if (b2 < a1){
        return false;
    }
    return true;
}

int main(){
    scanf("%d", &n);
    for (int i = 1; i <= n; i++){
        cin >> a[i] >> b[i];
    }
    a[n+1] = -1e9;
    b[n+1] = -1e9;
    int ans = -1;
    int len = 0;
    int now = INT_MIN;
    for (int i = 1; i <= n; i++){
        if (now < a[i]){
            //cout << i << " ATAS" << endl;
            len++;
            now = a[i];
            //cout << now << " " << len << endl;
        } else if (now >= a[i] && now <= b[i]){
            //cout << i << " TENGAH" << endl;
            len++;
            //cout << now << " " << len << endl;
        } else {
            //cout << "DROP!" << endl;
            len++;
            ans = max(ans, len);
            now = a[i];
            len = 1;
            //cout << now << " " << len << endl;
        }
    }
    cout << max(ans, len) << endl;
}

Compilation message

tem.cpp: In function 'int main()':
tem.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 267 ms 4428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 719 ms 6368 KB Output is correct
2 Incorrect 775 ms 17784 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 7008 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 7036 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1030 ms 6776 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 477 ms 7160 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 451 ms 6776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 927 ms 6300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 894 ms 6180 KB Output isn't correct
2 Halted 0 ms 0 KB -