結果

問題 No.2359 A in S ?
ユーザー t98slider
提出日時 2023-06-23 23:11:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 1,367 bytes
コンパイル時間 1,817 ms
コンパイル使用メモリ 178,700 KB
実行使用メモリ 16,896 KB
最終ジャッジ日時 2024-07-01 02:58:10
合計ジャッジ時間 6,182 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, mx = 100000;
cin >> n >> m;
int th = 320, x, y;
vector<int> cnt(mx + 1);
vector<vector<int>> cnt2(th, vector<int>(th));
vector<vector<pair<int,int>>> tb(mx + 2); //
vector<vector<pair<int,int>>> tb2(mx + 2); //
vector<vector<int>> tb3(mx + 2); //
for(int i = 0; i < n; i++){
int l, r, x, y;
cin >> l >> r >> x >> y;
if(x < th){
tb[l].emplace_back(x, y);
tb2[r + 1].emplace_back(x, y);
}else{
while(y <= r){
if(y >= l) cnt[y]++;
y += x;
}
}
}
vector<int> b(m), ans(m);
for(int i = 0; i < m; i++){
cin >> b[i];
tb3[b[i]].emplace_back(i);
}
for(int i = 0; i <= mx; i++){
for(auto &&pa : tb[i]){
tie(x, y) = pa;
cnt2[x][y]++;
}
for(auto &&pa : tb2[i]){
tie(x, y) = pa;
cnt2[x][y]--;
}
for(auto &&qi : tb3[i]){
for(int j = 1; j < th; j++){
ans[qi] += cnt2[j][i % j];
}
}
}
for(int i = 0; i < m; i++){
ans[i] += cnt[b[i]];
cout << ans[i] << '\n';
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0