結果
| 問題 |
No.865 24時間降水量
|
| コンテスト | |
| ユーザー |
i_am_nicolen_22
|
| 提出日時 | 2019-08-17 00:42:15 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,810 bytes |
| コンパイル時間 | 1,345 ms |
| コンパイル使用メモリ | 163,300 KB |
| 実行使用メモリ | 12,576 KB |
| 最終ジャッジ日時 | 2024-09-23 06:23:09 |
| 合計ジャッジ時間 | 2,963 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
class BIT
{
public:
vector<int> bit;
int M;
BIT(int M):
bit(vector<int>(M+1, 0)), M(M) {}
int sum(int i) {
if (!i) return 0;
return bit[i] + sum(i-(i&-i));
}
void add(int i, int x) {
if (i > M) return;
bit[i] += x;
add(i+(i&-i), x);
}
};
int a[200010];
int t[200010],v[200010];
signed main(){
int n,q;
cin>>n;
REP(i,n) cin>>a[i];
cin>>q;
REP(i,q) {
cin>>t[i]>>v[i];
t[i]--;
}
vector<pair<int,int>>w;
ll sum=0;
for (int i = 0; i < n; i++)
{ if(i<23) sum+=a[i];
else{
sum+=a[i];
w.push_back({sum,i-23});
sum-=a[i-23];
}
}
// show(w);
// cerr<<"a"<<endl;
int pre_max=0;
for (int i = 0; i < w.size(); i++)
{
if(pre_max<w[i].first) pre_max=w[i].first;
}
// cerr<<"b"<<endl;
for (int i = 0; i < q; i++)
{
//a[t[i]]=v[i];
// cerr<<v[i]-a[t[i]]<<endl;
for(int j=t[i]-24;j<t[i]+24;j++){
if(j<0 || j>=w.size()) continue;
if(w[j].second<t[i]-24 || w[j].second>t[i]) continue;
w[j].first+=v[i]-a[t[i]];
// if(j==w[j].first) break;
if(pre_max<w[j].first) pre_max=w[j].first;
}
a[t[i]]=v[i];
// cerr<<t[i]<<endl;
//show(w);
cout<<pre_max<<"\n";
}
return 0;
}
i_am_nicolen_22