# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1031077 | s_tree | City (JOI17_city) | C++17 | 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 "Device.h"
#include <bits/stdc++.h>
using namespace std;
const long long N = 250'010;
vector<long long> nms;
void InitDevice()
{
long double d = 1.05;
long double val = d;
while(val <= 3*N) {
if(!nms.size() or nms.back()!=(int)val)
nms.push_back(val);
val*=d;
}
}
int Answer(long long S, long long T)
{
// cout << nms.size() << " " << (S/(3*N)) << endl;
// cout << nms.size() << " " << (T/(3*N)) << endl;
long long fs = S/(3*N);
long long ss = fs+nms[S%(3*N)]-1;
long long ft = T/(3*N);
long long st = ft+nms[T%(3*N)]-1;
// cout << fs << " " << ss << endl;
// cout << ft << " " << st << endl;
// cout << endl;
if(fs <= ft and st <= ss)return 1;
if(ft <= fs and ss <= st)return 0;
return 2;
}
#include "Device.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 250'010;
vector<int> nms;
void InitDevice()
{
long double d = 1.05;
long double val = d;
while(val <= 3*N) {
if(!nms.size() or nms.back()!=(int)val)
nms.push_back(val);
val*=d;
}
}
int Answer(long long S, long long T)
{
// cout << nms.size() << " " << (S/(3*N)) << endl;
// cout << nms.size() << " " << (T/(3*N)) << endl;
int fs = S/(3*N);
int ss = fs+nms[S%(3*N)]-1;
int ft = T/(3*N);
int st = ft+nms[T%(3*N)]-1;
// cout << fs << " " << ss << endl;
// cout << ft << " " << st << endl;
// cout << endl;
if(fs <= ft and st <= ss)return 1;
if(ft <= fs and ss <= st)return 0;
return 2;
}