답안 #124652

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124652 2019-07-03T16:33:52 Z youssefbou62 Worst Reporter 3 (JOI18_worst_reporter3) C++14
12 / 100
823 ms 13068 KB
#include  <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
ll _abs (ll x ) { return (x>0?x:-x); }
const int N =500005 ;
int D[N] ;  
int place [1005][1005] ;  
int main(){
    fastio ; 
    int n , q ;  
    cin >> n >> q ; 
    for(int i = 0 ; i <= n ;i++ ){
        if( i ) 
        cin >> D[i] ; 
         place[0][i]= -i ;  
    }
    for( int t = 1 ; t <= 1000 ; t++ ){
        for (int p = 0 ; p <= n ; p++  ){
            if(t) place[t][p] = place[t-1][p] ; 
            if( !p )place[t][p]++ ; 
            if( p && -place[t][p]+place[t][p-1] > D[p]){
                place[t][p] = place[t][p-1] - 1 ; 
            }
            // reverse ( place[t] , place[t] + n + 1 ) ; 
        }
    }
    int t , l , r ; 
    // for(int t = 0 ; t < 3 ; t++ ){
    //     for(int i= 0 ; i<=n;i++){
    //         cout << place[t][i]<< " " ; 
    //     }
    //     cout << endl; 

    // }

    while ( q-- ){
        cin >> t >> l >> r ; 
        int ans =0 ; 
        for(int i = 0 ; i <= n ; i++ ){
            // cout << place[t][i]<<" " ; 
            if( place[t][i] >= l && place[t][i] <= r ) ans ++ ; 
        } cout << ans << endl; 
    }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 823 ms 13068 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 4344 KB Output is correct
2 Correct 10 ms 4344 KB Output is correct
3 Correct 10 ms 4220 KB Output is correct
4 Correct 11 ms 4240 KB Output is correct
5 Correct 11 ms 4344 KB Output is correct
6 Correct 10 ms 4296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 823 ms 13068 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -