제출 #1279772

#제출 시각아이디문제언어결과실행 시간메모리
1279772raphaelp고속도로 설계 (CEOI12_highway)C++20
100 / 100
2 ms580 KiB
#include <bits/stdc++.h> #include "office.h" using namespace std; int getCase() { bool temp = isOnLine(1, 2, 3); if (temp) return 0; temp = isOnLine(4, 5, 6); if (temp) return 1; temp = isOnLine(7, 8, 9); if (temp) return 2; return 3; } int main() { int N; N = GetN(); int T = getCase(); if (T == 3) { vector<int> group1; for (int i = 4; i <= 6; i++) { for (int j = 7; j <= 9; j++) { if (isOnLine(1, i, j)) { group1 = {1, i, j}; break; } } if (group1 != vector<int>{}) break; } vector<int> group2; for (int i = 2; i < 10; i++) { if (i == group1[1] || i == group1[2]) continue; if (!isOnLine(1, group1[1], i)) group2.push_back(i); } Answer(1, group1[1], group2[0], group2[1]); } if (T == 2) { vector<int> group2; for (int i = 1; i <= 6; i++) { if (!isOnLine(7, 8, i)) group2.push_back(i); } Answer(7, 8, group2[0], group2[1]); } if (T < 2) { vector<int> group1 = {1, 2, 3}; if (T == 1) group1 = {4, 5, 6}; vector<int> group2; int x = 1; while (group2.size() < 2) { if (T == 0 && x == 1) x = 4; int a = x++; if (T == 1 && x == 4) x = 7; if (x > N) { if (!isOnLine(group1[0], group1[1], a)) group2.push_back(a); break; } int b = x++; if (!isOnLine(group1[0], a, b)) { if (!isOnLine(group1[0], group1[1], a)) group2.push_back(a); else group2.push_back(b); } } Answer(group1[0], group1[1], group2[0], group2[1]); } }

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

office.c: In function 'int isOnLine(int, int, int)':
office.c:85:13: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   85 |     _Fin(0, "Protocol error");
      |             ^~~~~~~~~~~~~~~~
office.c:88:13: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   88 |     _Fin(0, "Protocol error");
      |             ^~~~~~~~~~~~~~~~
office.c:92:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   92 |     _Fin(false, "Too many questions");
      |                 ^~~~~~~~~~~~~~~~~~~~
office.c: In function 'void Answer(int, int, int, int)':
office.c:123:13: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  123 |     _Fin(0, "Protocol error");
      |             ^~~~~~~~~~~~~~~~
office.c:130:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  130 |          _Fin(true, "Correct");
      |                     ^~~~~~~~~
office.c:132:22: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  132 |          _Fin(false, "Wrong answer");
      |                      ^~~~~~~~~~~~~~
office.c:136:21: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  136 |          _Fin(true, "Correct");
      |                     ^~~~~~~~~
office.c:138:22: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  138 |          _Fin(false, "Wrong answer");
      |                      ^~~~~~~~~~~~~~
office.c:140:19: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  140 |       _Fin(false, "Wrong answer");
      |                   ^~~~~~~~~~~~~~
office.c:142:14: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  142 |   _Fin(true, "Correct");
      |              ^~~~~~~~~
office.c: In function 'void _doInit()':
office.c:33:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |     scanf("%d", &_N);
      |     ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...