이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Esti <3
//\
šťastia pre nás :)
// you're already the best
// _
// ^ ^ //
// >(O_O)<___//
// \ __ __ \
// \\ \\ \\\\
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("O3","unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("O3")
#pragma GCC target("popcnt")
using ll = long long;
#define int long long
#define forn(i,n) for(int i=0; i<(n); ++i)
#define pb push_back
#define pi pair<int,int>
#define f first
#define s second
#define vii(a,n) vector<int> a(n); forn(i,n) cin>>a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e18;
const int mod = 1e9+7;//998244353;
// \
\
:smiling_face_with_3_hearts: :smiling_face_with_3_hearts: :smiling_face_with_3_hearts:
//vidime sa veľmi skoro, moje slnko
void solve() {
int n, q; cin>>n>>q;
vector<pi> a(n);
forn(i,n) cin>>a[i].f>>a[i].s;
forn(i,q) {
int r,v; cin>>r>>v;
int last=0;
for (int j=r-1; j<n; ++j) {
//cout<<"? "<<a[i].f<<' '<<last<<'\n';
if (a[j].f > last) {
//cout<<"! "<<i<<' '<<v<<'\n';
v-=a[j].s;
last=a[j].f;
if (v<=0) {
cout<<j+1<<'\n';
break;
}
}
}
if (v>0) cout<<"0\n";
}
}
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t=1;
//cin>>t;
while (t--) solve();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
fountain.cpp:3:1: warning: multi-line comment [-Wcomment]
3 | //\
| ^
fountain.cpp:9:1: warning: multi-line comment [-Wcomment]
9 | // \ __ __ \
| ^
fountain.cpp:36:1: warning: multi-line comment [-Wcomment]
36 | // \
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |