답안 #905813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
905813 2024-01-13T04:54:33 Z Der_Vlapos Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 39436 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;
      |              ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3019 ms 39436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3006 ms 4348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 2 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -