# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
24172 |
2017-06-01T08:24:27 Z |
chpipis |
Nizovi (COI14_nizovi) |
C++11 |
|
19 ms |
2020 KB |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define iter(v, i) for (__typeof__((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define fast_io_without_cstdio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define all(v) (v).begin(), (v).end()
#define rep(i, s, e) for (int i = s; i < e; i++)
#ifdef __linux__
#define gc getchar_unlocked
#define pc putchar_unlocked
#else
#define gc getchar
#define pc putchar
#endif
#if __cplusplus <= 199711L
template<class BidirIt>
BidirIt prev(BidirIt it, typename iterator_traits<BidirIt>::difference_type n = 1) {
advance(it, -n);
return it;
}
template<class ForwardIt>
ForwardIt next(ForwardIt it, typename iterator_traits<ForwardIt>::difference_type n = 1) {
advance(it, n);
return it;
}
#endif
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ldouble;
const double EPS = 1e-9;
const double PI = 3.141592653589793238462;
template<typename T>
inline T sq(T a) { return a * a; }
//#ifdef LOCAL_MACHINE
//#endif
int comp(int i, int j) {
if (i == j) return 0;
printf("cmp %d %d\n", i, j);
fflush(stdout);
int res;
scanf("%d", &res);
return res;
}
void rev(int i, int j) {
if (i == j) return;
printf("reverse %d %d\n", i, j);
fflush(stdout);
}
int main() {
//freopen("", "r", stdin);
//freopen("", "w", stdout);
int len_a, len_b;
scanf("%d %d", &len_a, &len_b);
int a = 1, b = len_a + 1;
while (a <= len_a && b <= len_a + len_b) {
while (a <= len_a && comp(a, b) <= 0) a++;
if (a > len_a) break;
int st = b;
while (b + 1 <= len_a + len_b && comp(a, b + 1) > 0) b++;
rev(a, b);
rev(a, a + (b - st));
rev(a + (b - st) + 1, b);
b++;
}
puts("end");
fflush(stdout);
return 0;
}
Compilation message
nizovi.cpp: In function 'int comp(int, int)':
nizovi.cpp:57:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &res);
^
nizovi.cpp: In function 'int main()':
nizovi.cpp:71:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &len_a, &len_b);
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2020 KB |
Incorrect |
2 |
Incorrect |
0 ms |
2020 KB |
Incorrect |
3 |
Incorrect |
0 ms |
2020 KB |
Incorrect |
4 |
Incorrect |
3 ms |
2020 KB |
Incorrect |
5 |
Incorrect |
6 ms |
2020 KB |
Incorrect |
6 |
Incorrect |
9 ms |
2020 KB |
Incorrect |
7 |
Incorrect |
19 ms |
2020 KB |
Incorrect |
8 |
Incorrect |
6 ms |
2020 KB |
Incorrect |
9 |
Incorrect |
6 ms |
2020 KB |
Incorrect |
10 |
Incorrect |
6 ms |
2020 KB |
Incorrect |