Submission #430256

#TimeUsernameProblemLanguageResultExecution timeMemory
430256schsePainting Squares (IOI20_squares)C++17
0 / 100
1 ms328 KiB
#include "squares.h" #include <vector> #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> #define __K 9 std::vector<int> v; std::set<unsigned> s; void debuijn(unsigned int curp) { for (int i = 0; i < 2; ++i) { unsigned c = curp * 2 + i; if (s.find(c) == s.end()) { s.insert(c); debuijn(c % (1 << (__K))); v.push_back(i); } } } std::vector<int> paint(int n) { debuijn(0); while (v.size() > n) v.pop_back(); v.push_back(__K+1); return v; } int find_location(int n, std::vector<int> c) { if (c.back() == -1) { int p = n - c.size(); while (c.back() == -1) { p++; c.pop_back(); } return p; } for (int i = 0; i <= n - c.size(); i++) { bool b = true; for (int e = 0; e < c.size(); e++) b &= (c[e] == v[i + e]); if (b) return i; } return -1; }

Compilation message (stderr)

squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:29:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |  while (v.size() > n)
      |         ~~~~~~~~~^~~
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:48:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |  for (int i = 0; i <= n - c.size(); i++)
      |                  ~~^~~~~~~~~~~~~~~
squares.cpp:51:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |   for (int e = 0; e < c.size(); e++)
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...