답안 #344952

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
344952 2021-01-06T19:54:13 Z kkk Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
8 / 100
3000 ms 3692 KB
#include<iostream>
#include<cstring>
#define endl '\n'
using namespace std;
long long a[100003],d[100003],used[5002];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n,m,l,r,k,lpr=0,rpr,i,j;
    bool p,c;
    cin>>n>>m;rpr=n-1;
    for(i=0;i<n;i++)
    {
        cin>>d[i];
    }
    for(i=0;i<m;i++)
    {
        cin>>l>>r>>k;
        l--;r--;
        for(j=lpr;j<=rpr;j++)
        {
            a[j]=d[j];
        }
        lpr=l;rpr=r;  if(l==r ){cout<<1<<endl;continue;}
        p=true;c=false;
        while(p)
        {
            p=false;
            for(j=l;j<r;j++)
            {
                if(a[j]>a[j+1]&&a[j]+a[j+1]<=k){swap(a[j],a[j+1]);p=true;}
                else if(a[j]>a[j+1]&&a[j]+a[j+1]>k){c=true;p=false;break;}
            }
        }

      if(!c)cout<<1<<endl;
      else cout<<0<<endl;
     


    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 12 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 12 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 16 ms 492 KB Output is correct
13 Correct 27 ms 492 KB Output is correct
14 Correct 71 ms 492 KB Output is correct
15 Correct 11 ms 492 KB Output is correct
16 Execution timed out 3055 ms 364 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 26 ms 3692 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3051 ms 1900 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 12 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 16 ms 492 KB Output is correct
13 Correct 27 ms 492 KB Output is correct
14 Correct 71 ms 492 KB Output is correct
15 Correct 11 ms 492 KB Output is correct
16 Execution timed out 3055 ms 364 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 12 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 16 ms 492 KB Output is correct
13 Correct 27 ms 492 KB Output is correct
14 Correct 71 ms 492 KB Output is correct
15 Correct 11 ms 492 KB Output is correct
16 Execution timed out 3055 ms 364 KB Time limit exceeded
17 Halted 0 ms 0 KB -