# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
797907 | 2023-07-30T06:22:09 Z | vjudge1 | Worst Reporter 3 (JOI18_worst_reporter3) | C++17 | 448 ms | 11240 KB |
#include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define fi first #define se second #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 5e5 + 9 , mod = 1e9 + 7; ll d[N] = {} , a[N] = {}, dp[N] = {}, b[N] , c[N]; void solve(){ ll q , i , j , m ,n, z , s = 0, f, l , r , k , x , y , mn = 1e18 , mx = -1; cin>>n>>q; for(i = 1; i <= n; i++) cin>>a[i]; c[0] = 1 ; for(i = 1; i <= n; i++){ if(a[i] <= a[i - 1]) c[i] = c[i - 1]; else c[i] = ((a[i]) / c[i - 1] + (((a[i]) % c[i - 1]) != 0)) * c[i - 1]; //cout<<c[i]<<" "; } while(q--){ cin>>k>>x>>y; l = 0 , r = n; while(l != r){ m = (l + r + 1) / 2; if((k / c[m]) * c[m] + (-m) >= x) l = m; else r = m - 1; } f = l; l = 0, r= n; while(l != r){ m = (l + r) / 2; if((k / c[m]) * c[m] + (-m) <= y) r = m; else l = m + 1; } k = (((k / c[f]) * c[f] + (-f) >= x) && ((k / c[l]) * c[l] + (-l) <=y)); if(k == 1) cout<<max(0ll ,f - l + 1)<<"\n"; else cout<<0<<"\n"; } } int main(){ TL; /* #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif */ int t = 1; //cin>>t; while(t--) { solve(); } } // Author : حسن
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 441 ms | 11240 KB | Output is correct |
2 | Correct | 447 ms | 11204 KB | Output is correct |
3 | Correct | 436 ms | 11072 KB | Output is correct |
4 | Correct | 448 ms | 11080 KB | Output is correct |
5 | Correct | 445 ms | 11100 KB | Output is correct |
6 | Correct | 440 ms | 11044 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 441 ms | 11240 KB | Output is correct |
2 | Correct | 447 ms | 11204 KB | Output is correct |
3 | Correct | 436 ms | 11072 KB | Output is correct |
4 | Correct | 448 ms | 11080 KB | Output is correct |
5 | Correct | 445 ms | 11100 KB | Output is correct |
6 | Correct | 440 ms | 11044 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 252 ms | 9100 KB | Output is correct |
14 | Correct | 256 ms | 9148 KB | Output is correct |
15 | Correct | 247 ms | 9036 KB | Output is correct |
16 | Correct | 252 ms | 9124 KB | Output is correct |
17 | Correct | 328 ms | 10484 KB | Output is correct |
18 | Correct | 317 ms | 10560 KB | Output is correct |
19 | Correct | 327 ms | 10492 KB | Output is correct |
20 | Correct | 323 ms | 10456 KB | Output is correct |
21 | Correct | 322 ms | 10552 KB | Output is correct |
22 | Correct | 317 ms | 10488 KB | Output is correct |
23 | Correct | 326 ms | 10648 KB | Output is correct |
24 | Correct | 317 ms | 10552 KB | Output is correct |
25 | Correct | 443 ms | 11072 KB | Output is correct |
26 | Correct | 436 ms | 11084 KB | Output is correct |
27 | Correct | 360 ms | 10960 KB | Output is correct |
28 | Correct | 352 ms | 10792 KB | Output is correct |
29 | Correct | 349 ms | 10844 KB | Output is correct |
30 | Correct | 353 ms | 11008 KB | Output is correct |
31 | Correct | 355 ms | 10828 KB | Output is correct |
32 | Correct | 336 ms | 10572 KB | Output is correct |
33 | Correct | 0 ms | 212 KB | Output is correct |