제출 #865296

#제출 시각아이디문제언어결과실행 시간메모리
865296vjudge1Meteors (POI11_met)C++98
24 / 100
6095 ms36404 KiB
#include <bits/stdc++.h> #include <sstream> #include <fstream> /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// //WAS CREAtED BY BAISYN MUKHAMMED// /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// #define et "\n" #define ll long long #define ff first #define ss second #define pb push_back #define ioi ios::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define yes cout << "YES" << endl #define no cout << "NO" << endl using namespace std; const ll M = 1000000007; ll n,m,k,a[511111],b[311111],c[311111],p[311111]; map <ll,ll> mp,ans,mp1; vector <ll> v[311111]; void solve() { cin >> m >> n; for (int i = 1;i <= n;i++) { cin >> a[i]; } for (int i = 1;i <= m;i++) { cin >> b[i]; mp1[i] = b[i]; ans[i] = -1; } cin >> k; for (int i = 1;i <= k;i++) { ll l,r,x; cin >> l >> r >> x; if (l <= r) { for (int j = l;j <= r;j++) { mp[a[j]] += x; if (mp1[a[j]] <= mp[a[j]] && ans[a[j]] == -1) { ans[a[j]] = i; } } } else { for (int j = 1;j <= r;j++) { mp[a[j]] += x; if (mp1[a[j]] <= mp[a[j]] && ans[a[j]] == -1) { ans[a[j]] = i; } } for (int j = l;j <= n;j++) { mp[a[j]] += x; if (mp1[a[j]] <= mp[a[j]] && ans[a[j]] == -1) { ans[a[j]] = i; } } } // cout << et; } for (int i = 1;i <= m;i++) { // cout << mp[i] << et; if (ans[i] == -1) { cout << "NIE" << et; } else { cout << ans[i] << et; } } } int main () { ioi; // freopen("promote.in","r",stdin); // freopen("promote.out","w",stdout); ll t = 1; // cin >> t; while (t--) { // cout << "Case " << t1 << ':' << et; solve(); } }
#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...