Submission #905802

# Submission time Handle Problem Language Result Execution time Memory
905802 2024-01-13T04:50:48 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 39488 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
long double rnd(){return (long double)(rand()/RAND_MAX);}
main(){
    srand(time(NULL));
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int q;
    cin>>q;
    int a[n+1];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int l[q+1],r[q+1],x[q+1];
    for(int i=1;i<=q;i++){
        cin>>l[i]>>r[i]>>x[i];
        int b[n+1];
        for(int j=1;j<=n;j++){
            b[j]=a[j];
        }
        sort(b+l[i],b+r[i]+1);
        int mx=-INT_MAX;
        for(int j=l[i];j<=r[i];j++){
            if(b[j]!=a[j]){
                mx=b[j];
            }
        }
        bool ans=1;
        cout<<(b[l[i]]+mx<=x[i])<<endl;
    }
}

Compilation message

sortbooks.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
sortbooks.cpp: In function 'int main()':
sortbooks.cpp:32:14: warning: unused variable 'ans' [-Wunused-variable]
   32 |         bool ans=1;
      |              ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3058 ms 39488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3025 ms 4348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -