QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#39931#993. 100 Boxes Per Hour...AutumnKiteWA 66ms3608kbC++171.3kb2022-07-14 22:56:302022-07-14 22:56:30

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-14 22:56:30]
  • Judged
  • Verdict: WA
  • Time: 66ms
  • Memory: 3608kb
  • [2022-07-14 22:56:30]
  • Submitted

answer

#include <bits/stdc++.h>

const char name[] = "RGB";

int get() {
  char c;
  std::cin >> c;
  return std::find(name, name + 3, c) - name;
}

int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int T;
  std::cin >> T;
  while (T--) {
    int A, B, C;
    std::cin >> A >> B >> C;
    if (100 - std::max({A, B, C}) >= 43) {
      for (int i = 0; i < 100; ++i) {
        int x = get();
        if (x) {
          std::cout << "PLACE " << x << std::endl;
        } else {
          std::cout << "DISCARD" << std::endl;
        }
      }
    } else {
      int cnt[3] = {};
      int id[3] = {0, 1, 2};
      for (int i = 0; i < 100; ++i) {
        int x = get();
        if (id[x]) {
          std::cout << "PLACE " << id[x] << std::endl;
          ++cnt[x];
        } else {
          int ymin = (x + 1) % 3, ymax = (x + 2) % 3;
          if (cnt[ymin] > cnt[ymax]) {
            std::swap(ymin, ymax);
          }
          if (cnt[x] >= cnt[ymax]) {
            std::cout << "EMPTY " << id[ymin] << std::endl;
            cnt[ymin] = cnt[x] = 0;
            std::swap(id[ymin], id[x]);
            std::cout << "PLACE " << id[x] << std::endl;
            ++cnt[x];
          } else {
            std::cout << "DISCARD" << std::endl;
          }
        }
      }
    }
  }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 66ms
memory: 3608kb

input:

100
3 33 64
B
G
R
R
G
R
B
R
G
R
R
B
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
R
R
G
84 8 8
B
B
B
R
R
R
R
R
G
G
G
G
G
G
G
G
B
B
B
B
B
B
B
B
B
B
B
B
R
B
B
B
B
B
B
B
B
B
B
B
B...

output:

PLACE 2
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
PLACE 2
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 2
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 1
DISCARD
DISCARD
PLACE 1
DISC...

result:

wrong answer Bad score