結果

問題 No.2502 Optimization in the Dark
ユーザー chro_96
提出日時 2023-10-14 01:19:46
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 1,012 bytes
コンパイル時間 919 ms
コンパイル使用メモリ 28,160 KB
実行使用メモリ 25,580 KB
平均クエリ数 4.00
最終ジャッジ日時 2024-09-15 21:04:40
合計ジャッジ時間 3,785 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int n = 0;
  char s[4] = "";
  
  int res = 0;
  
  int max = 1;
  int rem[2] = {};
  
  res = scanf("%d", &n);
  
  printf("? %d %d 2 %d\n", max, 2*n, 2*n);
  fflush(stdout);
  res = scanf("%s", s);
  
  if (s[0] == 'Y') {
    max = 2;
  }
  
  printf("? %d %d 3 %d\n", max, 2*n, 2*n);
  fflush(stdout);
  res = scanf("%s", s);
  
  if (s[0] == 'Y') {
    max = 3;
  }
  
  if (max == 1) {
    rem[0] = 2;
    rem[1] = 3;
  } else if (max == 2) {
    rem[0] = 1;
    rem[1] = 3;
  } else {
    rem[0] = 1;
    rem[1] = 2;
  }
  
  printf("? %d %d %d %d\n", rem[0], n, rem[1], n);
  fflush(stdout);
  res = scanf("%s", s);
  
  if (s[0] == 'Y') {
    int s = rem[0];
    rem[0] = rem[1];
    rem[1] = s;
  }
  
  printf("!");
  for (int i = 0; i < n; i++) {
    printf(" %d %d", rem[0], max);
  }
  for (int i = 0; i < n; i++) {
    printf(" %d %d", rem[1], max);
  }
  for (int i = 0; i < n; i++) {
    printf(" %d %d", rem[0], rem[1]);
  }
  printf("\n");
  
  return 0;
}

0