답안 #1116398

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1116398 2024-11-21T14:56:03 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 28836 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;
    	vector<int>v,g;
    	for (int j = l; j <= r; j++){
    		v.pb(a[j]);
    		g.pb(a[j]);
    	}
    	sort(all(g));
    	for (int j = 0; j < g.sz()-1; j++){
    		if (v[j] > v[j+1] and v[j] + v[j+1] <= k) swap(v[j],v[j+1]);
    	}
    	int ans = 1;
    	for (int j = 0; j < v.sz(); j++){
    		if (v[j] != g[j]){
    			ans = 0;
    			break;
    		}
    	}
    	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:109: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]
  109 |      for (int j = 0; j < g.sz()-1; j++){
      |                      ~~^~~~~~~~~~
sortbooks.cpp:113: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]
  113 |      for (int j = 0; j < v.sz(); j++){
      |                      ~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3038 ms 28836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3034 ms 5492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -