Submission #865175

#TimeUsernameProblemLanguageResultExecution timeMemory
865175vjudge1Meteors (POI11_met)C++17
24 / 100
6055 ms14672 KiB
#include <bits/stdc++.h> #define ll long long #define Sayan ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout) #define all(a) a.begin() , a.end() #define Int(a,x) a+1 , a+1+x #define sz() size() #define F first #define S second #define pb push_back #define yes cout << "YES\n" #define no cout << "NO\n" #define pii pair<ll,ll> using namespace std ; const ll N = 3e5+5; const ll INF = 1e18; const ll mod = 1e9+7; /* ll binpow(ll a , ll b){ if(b == 0) return 1; if(b%2) return binpow(a , b-1) * a % mod; ll c = binpow(a , b/2) % mod; return c*c%mod; } */ ll a[N],coun[N]; ll k=440; ll otv[N]; ll gl[N],gr[N],x[N]; void solve(){ ll n,m; cin>>n>>m; for(ll i=1;i<=m;i++){ cin>>a[i]; } for(ll i=1;i<=n;i++){ cin>>coun[i]; } ll q; cin>>q; for(ll i=1;i<=q;i++){ cin>>gl[i]>>gr[i]>>x[i]; } for(ll i=1;i<=n;i++){ ll l=1,r=q,res=-1,posl=0; while(l<=r){ ll md=(l+r)/2; for(ll j=1;j<=m;j++){ otv[j]=0; } for(ll j=1;j<=md;j++){ if(gl[j]>gr[j]){ for(ll g=gl[j];g<=m;g++){ otv[a[g]]+=x[j]; } for(ll g=1;g<=gr[j];g++){ otv[a[g]]+=x[j]; } } else { for(ll g=gl[j];g<=gr[j];g++){ otv[a[g]]+=x[j]; } } } if(coun[i]>otv[i]){ l=md+1; } else { r=md-1; res=md; // cout<<md<<" "<<coun[i]<<" "<<otv[i]<<"\n"; } } if(res==-1)cout<<"NIE\n"; else cout<<res<<"\n"; } } signed main () { Sayan; ll t=1; //cin>>t; while(t--)solve(); }

Compilation message (stderr)

met.cpp: In function 'void solve()':
met.cpp:47:21: warning: unused variable 'posl' [-Wunused-variable]
   47 |   ll l=1,r=q,res=-1,posl=0;
      |                     ^~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...