# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
568677 | almothana05 | Strange Device (APIO19_strange_device) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define mod 1000000007
#define inf 10000000000000000
using namespace std;
vector<pair<long long , long long> >num;
map<pair<long long , long long> , long long>trans;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long menge , numm , nummer , ed , cmp , comp , erg = 0;;
cin >> menge >> cmp >> comp;
for(long long i = 0 ; i < menge ; i++){
cin >> numm >> nummer;
num.push_back({numm , nummer});
}
for(long long i = 0 ; i < menge ; i++){
for(long long j = num[i].first ; j <= num[i].second ; j++){
numm = (j + (long long)(j/comp)) % cmp;
nummer = (j) % comp;
trans[{numm , nummer}]++;
if(trans[{numm , nummer}] == 1){
erg++;
}
}
}
cout << erg << "\n";
}
2 16 13
2 5
18 18