# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93883 | dalgerok | Nice sequence (IZhO18_sequence) | C++14 | 408 ms | 35476 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>
using namespace std;
const int N = 4e5 + 5;
int n, m, pref[N], timer, ans;
void dfs(int v){
if(v - m >= 0 && pref[v - m] == 0){
dfs(v - m);
}
if(v + n <= ans && pref[v + n] == 0){
dfs(v + n);
}
pref[v] = ++timer;
}
void solve(){
cin >> n >> m;
ans = n + m - 1 - __gcd(n, m);
memset(pref, 0, sizeof(pref));
timer = 0;
for(int i = 0; i <= ans; i++){
if(!pref[i]){
dfs(i);
# | 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... |