/ SeriousOJ /

Record Detail

Compile Error

foo.cc: In function 'int main()':
foo.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<string> a(6);
      |   ^~~~~~
foo.cc:3:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    2 | #include <iostream>
  +++ |+#include <vector>
    3 | 
foo.cc:9:16: error: expected primary-expression before '>' token
    9 |   vector<string> a(6);
      |                ^
foo.cc:9:18: error: 'a' was not declared in this scope
    9 |   vector<string> a(6);
      |                  ^

Code


#include <iostream>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<string> a(6);
  a[0] = "RGB";
  for (int i = 1; i < 6; i++) {
    a[i] = a[i - 1];
    if (i & 1) {
      swap(a[i][0], a[i][1]);
    } else {
      swap(a[i][2], a[i][1]);
    }
  }
  int tt;
  cin >> tt;
  for (int tc = 1; tc <= tt; tc++) {
    int n;
    cin >> n;
    cout << a[n % 6] << '\n';
  }
  return 0;
}
 

Information

Submit By
Type
Submission
Problem
P1010 Red Green Blue
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-06 21:29:08
Judged At
2024-11-11 03:31:27
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes