제출 #44296

#제출 시각아이디문제언어결과실행 시간메모리
44296ssnsarang2023Zagonetka (COI18_zagonetka)C++17
0 / 100
14 ms380 KiB
#define debug #include <cstdio> #include <iostream> #include <algorithm> #include <functional> #include <vector> #include <cstring> #include <cmath> #include <queue> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> ii; #define SZ(x) ((int)x.size()) const int N = 105; int n, a[N], pos_small[N], pos_large[N]; int small[N], large[N]; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); small[i] = large[i] = a[i]; pos_small[a[i]] = pos_large[a[i]] = i; } for (int i = 1; i <= n; ++i) { for (int j = 1; j < pos_small[i]; ++j) { if (small[j] > i) { int idx = pos_small[i]; int tmp = small[idx]; small[idx] = small[j]; small[j] = tmp; printf("query "); for (int k = 1; k <= n; ++k) { printf("%d ", small[k]); } fflush(stdout); int re = 0; scanf("%d", &re); if (re == 1) { pos_small[small[idx]] = idx; break; } else { int tmp = small[idx]; small[idx] = small[j]; small[j] = tmp; } } } } for (int i = n; i >= 1; --i) { for (int j = 1; j < pos_large[i]; ++j) { if (large[j] < i) { int idx = pos_large[i]; int tmp = large[idx]; large[idx] = large[j]; large[j] = tmp; printf("query "); for (int k = 1; k <= n; ++k) { printf("%d ", large[k]); } fflush(stdout); int re = 0; scanf("%d", &re); if (re == 1) { pos_large[large[idx]] = idx; break; } else { int tmp = large[idx]; large[idx] = large[j]; large[j] = tmp; } } } } printf("end\n"); for (int i = 1; i <= n; ++i) { printf("%d ", small[i]); } puts(""); for (int i = 1; i <= n; ++i) { printf("%d ", large[i]); } fflush(stdout); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

zagonetka.cpp: In function 'int main()':
zagonetka.cpp:24:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
zagonetka.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
zagonetka.cpp:43:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &re);
     ~~~~~^~~~~~~~~~~
zagonetka.cpp:68:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &re);
     ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...