Submission #483594

#TimeUsernameProblemLanguageResultExecution timeMemory
483594ponytailMutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" #include <string> #include <bits/stdc++.h> using namespace std; int get_distance(int x, int y) { int res[6]; for(int i=0; i<6; i++) res[i] = ps[i][y] - (x==0 ? 0 : ps[i][x-1]); if(res[0] + res[4] != res[1] + res[5]) return -1; if(res[1] + res[3] != res[0] + res[2]) return -1; if(res[2] + res[5] != res[3] + res[4]) return -1; int ans = min(res[0], res[1]) + min(res[2], res[3]) + min(res[4], res[5]); res[0] -= min(res[0], res[1]); res[1] -= min(res[0], res[1]); res[2] -= min(res[2], res[3]); res[3] -= min(res[2], res[3]); res[4] -= min(res[4], res[5]); res[5] -= min(res[4], res[5]); for(int i=0; i<6; i++) ans += res[i]; ans--; return ans; }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:7:37: error: 'ps' was not declared in this scope
    7 |     for(int i=0; i<6; i++) res[i] = ps[i][y] - (x==0 ? 0 : ps[i][x-1]);
      |                                     ^~