# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
789530 |
2023-07-21T13:12:36 Z |
fatemetmhr |
라멘 (JOI14_ramen) |
C++17 |
|
3 ms |
340 KB |
// ~ 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
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 |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |