This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// ~ Be Name Khoda ~ //
#include "ramen.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const int maxn = 1e6 + 10;
const int maxn5 = 5e5 + 10;
const int maxnt = 1.2e6 + 10;
const int maxn3 = 1e3 + 10;
const int mod = 1e9 + 7;
const ll inf = 1e18;
int mn[maxn5], mx[maxn5];
vector <int> av1, av2;
void Ramen(int n) {
for(int i = 1; i < n; i += 2){
mx[i - 1] = i - 1;
mn[i - 1] = i;
if(Compare(i, i - 1) == 1)
swap(mx[i - 1], mn[i - 1]);
}
if(n & 1)
mn[n - 1] = mx[n - 1] = n - 1;
for(int i = 0; i < n; i += 2){
av1.pb(mx[i]);
av2.pb(mn[i]);
}
int ans1 = av1[0], ans2 = av2[0];
for(int i = 1; i < av1.size(); i++){
if(Compare(av1[i], ans1) == 1)
ans1 = av1[i];
if(Compare(ans2, av2[i]) == 1)
ans2 = av2[i];
}
Answer(ans2, ans1);
}
Compilation message (stderr)
ramen.cpp: In function 'void Ramen(int)':
ramen.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for(int i = 1; i < av1.size(); 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... |