답안 #1116406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1116406 2024-11-21T15:00:04 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 24004 KB
// Problem: E - Hedgehog Daniyar and Algorithms
// Contest: Virtual Judge - Selection
// URL: https://vjudge.net/contest/673521#problem/E
// Memory Limit: 256 MB
// Time Limit: 3000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <cassert>

#define int long long
#define ll long long;
#define rev reverse
#define ent '\n'
#define in insert
#define no "NO"
#define yes "YES"
#define sz size
#define pii pair<int,int>
#define pic pair<int,char>
#define pis pair<int,string>
#define pcc pair<char,char>
#define pci pair<char,int>
#define pcs pair<char,string>
#define pss pair<string,string>
#define psi pair<string,int>
#define psc pair<string,char>
#define pf push_front
#define pb push_back
#define F first
#define S second
#define con continue
#define ret return
#define all(x) x.begin(),x.end()
#define sayat_abi_crush_228 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

int gcd(int a, int b){ while(a>0 and b>0){ if (a>b) swap(a,b); b%=a;}return a;}

struct triad {int a,b,c; triad(int x,int y,int z):a(x),b(y),c(z){}};

bool cmp(pii a, pii b){
    if (a.F==b.F){
        return a.S<b.S;
    }
    return a.F<b.F;
}

int binpow(int x,int n){
    if (n==0) return 1;
    if (n%2==1) return (binpow(x,n-1)*x);
    else {
        int a=(binpow(x,n/2));
        return (a*a);
    }
}



const int maxn=1e6+5,MOD=1e9+7, inf = 2147483647, linf = 9223372036854775807;

int n,m,a[maxn];

void sayat_abi_sigma_228(){
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= m; i++){
    	int l,r,k;
    	cin >> l >> r >> k;
    	int ans = 1;
    	vector<int>v;
    	for (int j = l; j <= r; j++){
    		v.pb(a[j]);
    	}
    	for (int j = 0; j < v.sz()-1; j++){
    		if (v[j] > v[j+1] and v[j] + v[j+1] <= k) swap(v[j],v[j+1]);
    		else if (v[j] > v[j+1]){
    			ans = 0;
    		}
    	}
    	cout << ans << ent;
    }
}

signed main(){
    //freopen("slalom.in" , "r" , stdin);
    //freopen("slalom.out" , "w" , stdout);
    int t=1;
    sayat_abi_crush_228
    //cin>>t;
    for(int i = 1;i <= t;i++){
    //cout<<"Scenario #"<<i<<": ";
    sayat_abi_sigma_228();
    }
}

Compilation message

sortbooks.cpp: In function 'void sayat_abi_sigma_228()':
sortbooks.cpp:108:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  108 |      for (int j = 0; j < v.sz()-1; j++){
      |                      ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 336 KB Output is correct
12 Correct 27 ms 608 KB Output is correct
13 Correct 31 ms 764 KB Output is correct
14 Correct 51 ms 592 KB Output is correct
15 Correct 52 ms 592 KB Output is correct
16 Correct 84 ms 592 KB Output is correct
17 Correct 61 ms 336 KB Output is correct
18 Correct 81 ms 616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3053 ms 24004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3030 ms 4596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 336 KB Output is correct
12 Correct 27 ms 608 KB Output is correct
13 Correct 31 ms 764 KB Output is correct
14 Correct 51 ms 592 KB Output is correct
15 Correct 52 ms 592 KB Output is correct
16 Correct 84 ms 592 KB Output is correct
17 Correct 61 ms 336 KB Output is correct
18 Correct 81 ms 616 KB Output is correct
19 Execution timed out 3050 ms 6452 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 7 ms 336 KB Output is correct
12 Correct 27 ms 608 KB Output is correct
13 Correct 31 ms 764 KB Output is correct
14 Correct 51 ms 592 KB Output is correct
15 Correct 52 ms 592 KB Output is correct
16 Correct 84 ms 592 KB Output is correct
17 Correct 61 ms 336 KB Output is correct
18 Correct 81 ms 616 KB Output is correct
19 Execution timed out 3053 ms 24004 KB Time limit exceeded
20 Halted 0 ms 0 KB -