# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
204504 | 2020-02-26T07:05:05 Z | theStaticMind | Worst Reporter 3 (JOI18_worst_reporter3) | C++14 | 737 ms | 15568 KB |
#include<bits/stdc++.h> #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; vector<int> slow; vector<ii> mv; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, q; cin >> n >> q; slow.pb(1); for(int i = 0; i < n; i++){ int x; cin >> x; slow.pb(x); } mv.pb({1, 1}); for(int i = 1; i < slow.size(); i++){ int px = mv.back().first; int pt = mv.back().second; int cx = slow[i]; if(pt > 2e9)break; int k = (cx - 1) / px + 1; mv.pb({k * px, k * pt}); } while(q--){ int t, x, y; cin >> t >> x >> y; int l = 0, r = sz(mv) - 1, low = 0, high = -1; while(l <= r){ int mid = (l + r) / 2; int curr = -mid + (t / mv[mid].second) * mv[mid].first; if(curr <= y){ low = mid; r = mid - 1; } else l = mid + 1; } l = 0, r = sz(mv) - 1; while(l <= r){ int mid = (l + r) / 2; int curr = -mid + (t / mv[mid].second) * mv[mid].first; if(x <= curr){ high = mid; l = mid + 1; } else r = mid - 1; } if(high < low)cout << "0\n"; else cout << high - low + 1 << "\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 737 ms | 15568 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 380 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 737 ms | 15568 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |