Submission #1067476

# Submission time Handle Problem Language Result Execution time Memory
1067476 2024-08-20T17:35:37 Z dosts Combo (IOI18_combo) C++17
91 / 100
19 ms 2032 KB
#include "combo.h"
//Dost SEFEROĞLU
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<    
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int MOD = 1e9+7,inf = 2e18;
const int N = 1e5+50;
 
string guess_sequence(int32_t N) {
  string cur;
  vector<char> chars = {'A','B','X','Y'};
  char firstletter = '0';
  random_shuffle(all(chars));
  for (auto it : chars) {
    if (it == chars.back()) continue;
    string ss;
    ss+=it;
    if (press(ss)) {
      firstletter = it;
      break;
    }
  }
  if (firstletter == '0') firstletter = chars.back();
  char alterone = '0',altertwo = '0',alterthree = '0';
  for (auto it : chars) {
    if (it != firstletter) {
      if (alterone == '0') alterone = it;
      else if (altertwo == '0') altertwo = it;
      else if (alterthree == '0') alterthree = it;
    }
  }
  cur+=firstletter;
  for (int i=2;i<=N-1;i++) {
    string presser = cur;
    presser+=altertwo;
    presser+=cur;
    presser+=alterone;
    presser+=altertwo;
    presser+=cur;
    presser+=alterone;
    presser+=alterthree;
    presser+=cur;
    presser+=alterone;
    presser+=alterone;
    int v = press(presser);
    if (v == cur.length()){
      cur+=alterthree;
      continue;
    }
    else if (v == cur.length()+1) {
      cur+=altertwo;
      continue;
    }
    else cur+=alterone;
  }
  char rem = chars.back();
  chars.pop_back();
  random_shuffle(all(chars));
  for (auto it : chars) {
    if (it == firstletter) continue;
    string curr = cur;
    curr+=it;
    if (press(curr) > cur.length()) {
      cur+=it;
      break;
    }
  }
  if (cur.length() != N) cur+=rem;
  return cur;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int32_t)':
combo.cpp:52:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     if (v == cur.length()){
      |         ~~^~~~~~~~~~~~~~~
combo.cpp:56:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |     else if (v == cur.length()+1) {
      |              ~~^~~~~~~~~~~~~~~~~
combo.cpp:69:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |     if (press(curr) > cur.length()) {
      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:74:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int32_t' {aka 'int'} [-Wsign-compare]
   74 |   if (cur.length() != N) cur+=rem;
      |       ~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Partially correct 0 ms 344 KB Output is partially correct
3 Partially correct 0 ms 344 KB Output is partially correct
4 Partially correct 1 ms 344 KB Output is partially correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Partially correct 0 ms 344 KB Output is partially correct
10 Partially correct 0 ms 344 KB Output is partially correct
11 Correct 0 ms 344 KB Output is correct
12 Partially correct 0 ms 344 KB Output is partially correct
13 Partially correct 0 ms 344 KB Output is partially correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 14 ms 652 KB Output is correct
18 Correct 13 ms 616 KB Output is correct
19 Partially correct 15 ms 1588 KB Output is partially correct
20 Correct 15 ms 600 KB Output is correct
21 Partially correct 16 ms 540 KB Output is partially correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Partially correct 1 ms 344 KB Output is partially correct
25 Partially correct 1 ms 412 KB Output is partially correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 440 KB Output is correct
29 Partially correct 1 ms 344 KB Output is partially correct
30 Partially correct 1 ms 344 KB Output is partially correct
31 Correct 1 ms 460 KB Output is correct
32 Partially correct 14 ms 484 KB Output is partially correct
33 Correct 16 ms 600 KB Output is correct
34 Correct 16 ms 516 KB Output is correct
35 Partially correct 15 ms 1492 KB Output is partially correct
36 Correct 18 ms 504 KB Output is correct
37 Correct 19 ms 600 KB Output is correct
38 Partially correct 15 ms 696 KB Output is partially correct
39 Correct 14 ms 728 KB Output is correct
40 Correct 15 ms 1852 KB Output is correct
41 Partially correct 13 ms 560 KB Output is partially correct
42 Correct 15 ms 608 KB Output is correct
43 Correct 16 ms 480 KB Output is correct
44 Correct 16 ms 480 KB Output is correct
45 Correct 14 ms 1372 KB Output is correct
46 Correct 14 ms 724 KB Output is correct
47 Partially correct 14 ms 652 KB Output is partially correct
48 Partially correct 15 ms 624 KB Output is partially correct
49 Correct 14 ms 480 KB Output is correct
50 Correct 14 ms 2032 KB Output is correct
51 Correct 18 ms 476 KB Output is correct
52 Partially correct 15 ms 528 KB Output is partially correct
53 Correct 15 ms 484 KB Output is correct
54 Correct 15 ms 724 KB Output is correct
55 Correct 16 ms 1720 KB Output is correct
56 Correct 15 ms 712 KB Output is correct
57 Correct 12 ms 1836 KB Output is correct
58 Correct 17 ms 596 KB Output is correct
59 Partially correct 15 ms 600 KB Output is partially correct
60 Partially correct 17 ms 600 KB Output is partially correct
61 Correct 16 ms 720 KB Output is correct
62 Correct 15 ms 1496 KB Output is correct
63 Partially correct 16 ms 548 KB Output is partially correct
64 Partially correct 14 ms 1328 KB Output is partially correct
65 Correct 16 ms 948 KB Output is correct
66 Correct 14 ms 680 KB Output is correct
67 Partially correct 14 ms 880 KB Output is partially correct
68 Partially correct 16 ms 480 KB Output is partially correct
69 Correct 15 ms 1480 KB Output is correct
70 Correct 16 ms 720 KB Output is correct
71 Partially correct 13 ms 800 KB Output is partially correct
72 Correct 15 ms 484 KB Output is correct
73 Correct 15 ms 480 KB Output is correct
74 Correct 14 ms 488 KB Output is correct
75 Correct 16 ms 500 KB Output is correct
76 Partially correct 16 ms 636 KB Output is partially correct
77 Correct 14 ms 488 KB Output is correct
78 Correct 0 ms 344 KB Output is correct
79 Correct 0 ms 344 KB Output is correct
80 Correct 0 ms 344 KB Output is correct
81 Partially correct 0 ms 344 KB Output is partially correct
82 Correct 0 ms 344 KB Output is correct
83 Correct 0 ms 344 KB Output is correct
84 Correct 0 ms 344 KB Output is correct
85 Partially correct 0 ms 344 KB Output is partially correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 1 ms 344 KB Output is correct
88 Correct 0 ms 344 KB Output is correct
89 Correct 0 ms 344 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 1 ms 344 KB Output is correct
92 Correct 0 ms 344 KB Output is correct
93 Partially correct 0 ms 344 KB Output is partially correct
94 Partially correct 0 ms 344 KB Output is partially correct
95 Correct 1 ms 344 KB Output is correct
96 Correct 0 ms 344 KB Output is correct
97 Partially correct 1 ms 344 KB Output is partially correct
98 Partially correct 1 ms 344 KB Output is partially correct
99 Correct 1 ms 344 KB Output is correct
100 Correct 1 ms 344 KB Output is correct
101 Correct 0 ms 344 KB Output is correct
102 Correct 0 ms 344 KB Output is correct
103 Correct 0 ms 344 KB Output is correct
104 Correct 0 ms 344 KB Output is correct
105 Partially correct 1 ms 344 KB Output is partially correct
106 Partially correct 1 ms 344 KB Output is partially correct
107 Correct 0 ms 344 KB Output is correct
108 Correct 1 ms 344 KB Output is correct
109 Partially correct 0 ms 344 KB Output is partially correct
110 Partially correct 0 ms 344 KB Output is partially correct
111 Correct 0 ms 344 KB Output is correct
112 Correct 0 ms 344 KB Output is correct
113 Partially correct 0 ms 344 KB Output is partially correct
114 Partially correct 0 ms 344 KB Output is partially correct
115 Correct 0 ms 344 KB Output is correct
116 Correct 0 ms 344 KB Output is correct
117 Partially correct 0 ms 344 KB Output is partially correct
118 Correct 0 ms 344 KB Output is correct
119 Correct 0 ms 344 KB Output is correct
120 Correct 1 ms 344 KB Output is correct
121 Partially correct 0 ms 344 KB Output is partially correct
122 Partially correct 1 ms 344 KB Output is partially correct
123 Correct 1 ms 344 KB Output is correct