Submission #24172

#TimeUsernameProblemLanguageResultExecution timeMemory
24172chpipisNizovi (COI14_nizovi)C++11
0 / 100
19 ms2020 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...