Submission #1130167

#TimeUsernameProblemLanguageResultExecution timeMemory
1130167ByeWorldA Difficult(y) Choice (BOI21_books)C++20
20 / 100
226 ms3512 KiB
#include <bits/stdc++.h> #include "books.h" #define ll long long #define pb push_back #define fi first #define se second #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) #define ld long double using namespace std; typedef pair<ll,ll> pii; typedef pair<char,char> pcc; typedef pair<ll,pii> ipii; typedef pair<pii,pii> ipiii; const int MAXN = 1e5+20; const int MAXA = 1e6; const int INF = 1e18+10; const int MOD = 1e9+7; const int LOG = 32; const ld EPS = 1e-12; int n, query, num; ll a; map<ll,ll> m; ll que(int x){ if(m.find(x) == m.end()){ m[x] = skim(x); } return m[x]; } void solve(int N, int K, long long A, int S) { n = N, num = K, a = A; query = S; // TODO implement this function for(int i=1; i<=n; i++) que(i); set <pii> s; for(int i=1; i<=n; i++) s.insert({m[i], i}); for(int i=1; i<=n-num+2; i++){ ll te = 0; for(int j=i; j<=i+num-2; j++) te += que(j), s.erase(pii(m[j],j)); auto it = s.lower_bound(pii(a-te, -1)); if(it!=s.end() && a<=te+(*it).fi && te+(*it).fi <= 2*a){ vector<int>vec; for(int j=i; j<=i+num-2; j++) vec.pb(j); vec.pb((*it).se); answer(vec); } for(int j=i; j<=i+num-2; j++) s.insert(pii(m[j],j)); } impossible(); }

Compilation message (stderr)

books.cpp:20:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   20 | const int INF = 1e18+10;
      |                 ~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...