| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 976785 | AIF_is_carving | 이상한 기계 (APIO19_strange_device) | C++17 | 5033 ms | 524288 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(){
set<pair<ll, ll>> s;
ll n, A, B; cin>>n>>A>>B;
if(n>1){
for(int i=0; i<n; i++){
ll x, y; cin>>x>>y;
for(ll t = x; t<=y; t++){
ll p = (t+(t/B))%A;
ll q = t%B;
s.insert({p,q});
}
}
cout<<s.size()<<"\n";
}
else{
//ll n, A, B; cin>>n>>A>>B;
ll x, y; cin>>x>>y;
ll X = A/(gcd(B+1, A));
ll t;
int powX=0, powB=0;
ll xxx = X;
while(xxx>0){
xxx/=2;
powX+=1;
}
xxx=B;
while(xxx>0){
xxx/=2;
powB+=1;
}
if(powB+powX>61) t=2e18;
else t = B*X;
cout<<min<ll>(y-x+1, t)<<"\n";
}
return;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t=1; //cin>>t;
while(t--){
solve();
}
return 0;
}
| # | 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... | ||||
