제출 #1181419

#제출 시각아이디문제언어결과실행 시간메모리
1181419al95ireyizFountain (eJOI20_fountain)C++20
30 / 100
408 ms589824 KiB
// It's the evening of another day. And the end of mine... #pragma GCC optimize("O3") #pragma GCC optimize("fast-math") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("no-stack-protector") #include<bits/stdc++.h> using namespace std; // #include<ext/pb_ds/assoc_container.hpp> \ #include<ext/pb_ds/tree_policy.hpp> \ using namespace __gnu_pbds; \ template<class T> \ using Tree=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statisticslmode_update>; #if !defined(ONLINE_JUDGE) and !defined(EVAL) #include "template/debug.h" #else #define d(x...) #endif string sp=" "; #define F ୨୧ #define fr first #define er erase #define sc second #define in insert #define ll long long #define pb push_back #define mkp make_pair #define qll queue<ll> #define dqll deque<ll> #define mll map<ll,ll> #define vll vector<ll> #define pll pair<ll,ll> #define ull unsigned ll #define mne min_element #define mxe max_element #define rs(x)resize(x) #define vpll vector<pll> #define vvll vector<vll> #define pq priority_queue #define len(x)(ll)x.size() #define lcm(x,y)x/gcd(x,y)*y #define all(x)x.begin(),x.end() #define umll unordered_map<ll,ll> #define lg2(x)(63ll-__builtin_clzll(x)) #define precision(x)fixed<<setprecision(x) #define popcnt(x)(ll)__builtin_popcountll(x) template<typename t1,typename t2>istream&operator>>(istream&is,pair<t1,t2>&x){return is>>x.fr>>x.sc;} template<typename t1,typename t2>ostream&operator<<(ostream&os,pair<t1,t2>&x){return os<<x.fr<<' '<<x.sc;} template<typename t1>istream&operator>>(istream&is,vector<t1>&vc){for(t1&j:vc)is>>j;return is;} template<typename t1>ostream&operator<<(ostream&os,vector<t1>&vc){for(t1&j:vc)os<<j<<sp;return os;} // #define ll int_fast32_t // #define ll int_fast64_t // #pragma GCC optimize("O2") // #pragma GCC target("avx,avx2,fma") // #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") const ll INF=1e9; const ll INFL=1e18; const ll MOD=1e9+7; // const ll MOD=998244353; const ll maxn=1e5+5; ll n,m,k=0; inline void prc(){} #define ll int ll nxt[maxn], v[maxn], w[maxn]; vector<vpll> cap(maxn); bool vis[maxn]; void dfs(ll u){ vis[u] = 1; if(!vis[nxt[u]]) dfs(nxt[u]); cap[u].pb({w[u], u}); for(auto [tmpp, v] : cap[nxt[u]]){ cap[u].pb({tmpp + w[u], v}); } } void _(ll&tt){ cin>>n>>m; for(ll i=1;i<=n;i++) cin>>v[i]>>w[i]; pq<pll, vpll, greater<pll>>q; vis[n+1] = 1; cap[n+1].pb({0, 0}); for(ll i=1;i<=n;i++){ while(!q.empty() and q.top().fr < v[i]){ nxt[q.top().sc] = i; q.pop(); } nxt[i] = n+1; // yere tokulur q.push({v[i], i}); } for(ll i=1;i<=n;i++){ if(!vis[i]) dfs(i); } // for(ll i=1;i<=n;i++){ // cout<<i<<' '<<cap[i]<<'\n'; // } for(ll i=0,a,b;i<m;i++){ cin>>a>>b; if(b > cap[a].back().fr){ cout<<0<<'\n'; } else{ ll l=0, r=len(cap[a])-1, cv; while(l<=r){ ll md = (l+r)>>1; if(cap[a][md].fr >= b) r = md - 1, cv = cap[a][md].sc; else l = md + 1; } cout<<cv<<'\n'; } } } signed main(){ clock_t testcaseruntime=clock(); cin.tie(0)->sync_with_stdio(0); prc(); ll t=1; // cin>>t; for(ll tt=1;tt<=t;tt++){ // cout<<"Case "<<tt<<": "; _(tt); } cerr<<"\n\033[1;31mTime: \033[1;30m"<<(double)(clock()-testcaseruntime)/CLOCKS_PER_SEC<<"\033[1;32m seconds"<<'\n'; }

컴파일 시 표준 에러 (stderr) 메시지

fountain.cpp:62: warning: "ll" redefined
   62 | #define ll int
      | 
fountain.cpp:24: note: this is the location of the previous definition
   24 | #define ll long long
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...