이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair < ll ,ll> pll;
ll n,a,b;
map < pll , ll >vis;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> a >> b;
ll le,ri, ans = 0;
bool all = 0;
for(ll i = 0; i < n; i++){
cin >> le >> ri;
if(ri-le+1==a*b){
all = 1;
}
for(ll j = le; j <= ri&&!all; j++){
ll t = j;
ll x = (t+(t/b))%a;
ll y = t%b;
if(!vis[{x,y}]){
ans++;
}
vis[{x,y}]++;
}
}
if(all)ans=a*b;
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |