Submission #828627

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8286272023-08-17 12:51:42Abrar_Al_SamitCounting Mushrooms (IOI20_mushrooms)C++17
79.86 / 100
8 ms408 KiB
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
const int bl = 280;
int count_mushrooms(int n) {
vector<int>mac;
int c1 = use_machine(mac = {0, 1});
if(n==2) return 1 + 1-c1;
int c2 = use_machine(mac = {0, 2});
int tp[n];
tp[0] = 1;
tp[1] = 1-c1;
tp[2] = 1-c2;
int s1, s2;
if(c1 && c2) s1 = 1, s2 = 2;
else {
s1 = 0;
if(c1) s2 = 2;
else s2 = 1;
}
for(int i=3; i<min(bl, n); i+=2) {
if(i==n-1) {
tp[i] = 1 - use_machine(mac = {0, i});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:65:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |   for(int j=0; j<cl[mxw].size(); ++j) {
      |                ~^~~~~~~~~~~~~~~
mushrooms.cpp:68:25: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   68 |     while(cl[mxw].size()!=j+1) cl[mxw].pop_back();
      |           ~~~~~~~~~~~~~~^~~~~
mushrooms.cpp:72:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |    if(j!=cl[mxw].size()-1) mac.push_back(cr), ++cr;
      |       ~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...