結果

問題 No.2359 A in S ?
ユーザー HIcoderHIcoder
提出日時 2023-07-02 10:34:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 828 bytes
コンパイル時間 3,172 ms
コンパイル使用メモリ 82,484 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-23 06:45:32
合計ジャッジ時間 7,607 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,500 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const ll MOD=1e9+7;


int main(){
    int N,M;
    cin>>N>>M;
    vector<int> L(N),R(N),X(N),Y(N);
    for(int i=0;i<N;i++){
        cin>>L[i]>>R[i]>>X[i]>>Y[i];
    }


    vector<int> A(M);
    for(int i=0;i<M;i++)cin>>A[i];

    vector<int> cnt(100000+10);
    for(int i=0;i<N;i++){
        int l=L[i]-Y[i];
        int r=R[i]-Y[i];
        ll x=X[i];
        ll left=(l+x-1)/x*x;
        ll y=Y[i];
        for(ll t=left+y;t<=R[i];t+=x){
            cnt[t]++;
        }
    }

    for(int i=0;i<M;i++){

        cout<<cnt[A[i]]<<endl;
    }



}
0