結果
問題 |
No.3265 地元に帰れば天才扱い!
|
ユーザー |
![]() |
提出日時 | 2025-09-06 15:41:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,239 bytes |
コンパイル時間 | 2,577 ms |
コンパイル使用メモリ | 206,164 KB |
実行使用メモリ | 814,720 KB |
最終ジャッジ日時 | 2025-09-06 15:41:55 |
合計ジャッジ時間 | 7,447 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 RE * 1 |
other | MLE * 1 -- * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); ++i) using ll = long long; using P = pair<int,int>; const double PI = acos(-1); int main(){ int n,m; cin >> n >> m; vector<vector<int>>cdn(n+1,vector<int>(m+1)); vector<vector<bool>>check(n+1,vector<bool>(m+1)); vector<P>lr(n+1); vector<int>A(n+1); rep(i,n){ int a,l,r; cin >> a >> l >> r; A[i+1]=a; lr[i+1]=pair(l,r); } int q; cin >> q; rep(i,n){ for(int j=lr[i].first; j<lr[i].second+1; j++){ check[i+1][j]=true; } } rep(i,n)rep(j,m) if(check[i+1][j]==true) cdn[i+1][j]=A[i+1]; rep(i,q){ int ans = 0; int x,y,u,v; cin >> x >> y >> u >> v; lr[x]=pair(u,v); for(int j=u;j<v+1;j++){ check[x][j]=true; } rep(j,u) check[x][j]=false; for(int j=v; j<m+2;j++) check[x][j]=false; rep(j,m+2) { if(cdn[x][j]) cdn[x][j]=A[x]; else cdn[x][j]=0; } rep(j,n)rep(k,m) { ans-=cdn[j+1][k+1]; } rep(j,n) ans+=A[j+1]*(lr[j+1].second-lr[j+1].first+1); cout << ans << endl; } return 0; } /**/