結果
問題 | No.2359 A in S ? |
ユーザー | kotatsugame |
提出日時 | 2023-06-23 21:46:23 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 186 ms / 2,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 538 ms |
コンパイル使用メモリ | 70,344 KB |
実行使用メモリ | 259,592 KB |
最終ジャッジ日時 | 2023-09-13 16:46:34 |
合計ジャッジ時間 | 6,069 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 141 ms
259,428 KB |
testcase_01 | AC | 143 ms
259,528 KB |
testcase_02 | AC | 141 ms
259,400 KB |
testcase_03 | AC | 142 ms
259,332 KB |
testcase_04 | AC | 185 ms
259,340 KB |
testcase_05 | AC | 186 ms
259,336 KB |
testcase_06 | AC | 156 ms
259,332 KB |
testcase_07 | AC | 157 ms
259,592 KB |
testcase_08 | AC | 154 ms
259,336 KB |
testcase_09 | AC | 146 ms
259,420 KB |
testcase_10 | AC | 155 ms
259,320 KB |
testcase_11 | AC | 157 ms
259,424 KB |
testcase_12 | AC | 147 ms
259,424 KB |
testcase_13 | AC | 147 ms
259,360 KB |
testcase_14 | AC | 147 ms
259,360 KB |
testcase_15 | AC | 148 ms
259,336 KB |
testcase_16 | AC | 148 ms
259,424 KB |
testcase_17 | AC | 149 ms
259,388 KB |
testcase_18 | AC | 148 ms
259,340 KB |
testcase_19 | AC | 147 ms
259,336 KB |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cassert> using namespace std; int N,M; int cnt[1<<17]; const int LIM=500; int imos[LIM][1<<17]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>M; for(int i=0;i<N;i++) { int L,R,X,Y; cin>>L>>R>>X>>Y; R++; int low=L-Y; if(low<=0)low=Y; else low=(low+X-1)/X*X+Y; if(X>=LIM) { while(low<R) { cnt[low]++; low+=X; } } else { if(low<R) { imos[X][low]++; int d=R-low; d=(d+X-1)/X*X; if(low+d<1<<17)imos[X][low+d]--; } } } for(int x=1;x<LIM;x++) { for(int y=0;y+x<1<<17;y++)imos[x][y+x]+=imos[x][y]; for(int y=0;y<1<<17;y++)cnt[y]+=imos[x][y]; } for(int i=0;i<M;i++) { int a;cin>>a; cout<<cnt[a]<<"\n"; } }