Submission #448668

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4486682021-07-31 12:54:56prvocisloGame (eJOI20_game)C++17
100 / 100
9 ms1348 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
const int inf = 1e9 + 5, maxn = 21;
vector<int> cycles, paths;
map<vector<int>, int> m;
void chmin(int& a, const int& b) { a = min(a, b); }
void chmax(int& a, const int& b) { a = max(a, b); }
int solve(int ic, int ip, int left, int typ) // typ = -1 ak to je uz odseknute, 0 je cesta, 1 je cyklus
{
if (ic+1 == cycles.size() && ip+1 == paths.size()) return left;
if (m.count({ ic, ip, left, typ })) return m[{ic, ip, left, typ }];
int &ans = m[{ic, ip, left, typ }] = -inf;
if (typ == 0 && left > 2) chmax(ans, left - 2 - solve(ic, ip, 2, -1));
if (typ == 1 && left >= 4) chmax(ans, left - 4 - solve(ic, ip, 4, -1));
if (ic + 1 != cycles.size())
chmax(ans, left - solve(ic + 1, ip, cycles[ic + 1], 1));
if (ip + 1 != paths.size())
chmax(ans, left - solve(ic, ip + 1, paths[ip + 1], 0));
return ans;
}
vector<vector<int> > g(maxn * maxn);
vector<string> h(maxn), v(maxn);
vector<bool> vis(maxn * maxn, false);
int r, c;
void dfs(int u, int& cntv, int& cnte)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

game.cpp: In function 'int solve(int, int, int, int)':
game.cpp:14:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     if (ic+1 == cycles.size() && ip+1 == paths.size()) return left;
      |         ~~~~~^~~~~~~~~~~~~~~~
game.cpp:14:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     if (ic+1 == cycles.size() && ip+1 == paths.size()) return left;
      |                                  ~~~~~^~~~~~~~~~~~~~~
game.cpp:19:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     if (ic + 1 != cycles.size())
      |         ~~~~~~~^~~~~~~~~~~~~~~~
game.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     if (ip + 1 != paths.size())
      |         ~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...