Submission #922667

#TimeUsernameProblemLanguageResultExecution timeMemory
922667tvladm2009Mutating DNA (IOI21_dna)C++17
Compilation error
0 ms0 KiB
#include "dna.h" #include <iostream> #include <complex> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <numeric> #include <cstring> #include <ctime> #include <cstdlib> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <list> #include <cmath> #include <bitset> #include <cassert> #include <queue> #include <stack> #include <deque> #include <random> using namespace std; template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;} template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;} #define files(FILENAME) read(FILENAME); write(FILENAME) #define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin) #define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout) #define all(c) (c).begin(), (c).end() #define sz(c) (int)(c).size() #define left left228 #define right right228 #define y1 y1228 #define mp make_pair #define pb push_back #define y2 y2228 #define rank rank228 using ll = long long; using ld = long double; const string FILENAME = "input"; const int MAXN = 100228; int cnt[MAXN][3][3]; void init(string a, string b) { string alf = "ACT"; for (int i = 1; i <= sz(a); i++) { for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { cnt[i][j][k] = cnt[i - 1][j][k] + (a[i - 1] == alf[j] && b[i - 1] == alf[k]); } } } } int get_distance(int l, int r) { int res = 0, prv = 0; for (int i = 0; i < 3; i++) { int j = (i + 1) % 3; int x = dp[r + 1][i][j] - dp[l][i][j]; int y = dp[r + 1][j][i] - dp[l][j][i]; if (i != 0) { if (prev != x - y) { return -1; } } else { res += 2 * abs(x - y); prev = x - y; } res += min(x, y); } return res; } /** int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //read(FILENAME); return 0; } **/

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:62:11: error: 'dp' was not declared in this scope; did you mean 'mp'?
   62 |   int x = dp[r + 1][i][j] - dp[l][i][j];
      |           ^~
      |           mp
dna.cpp:65:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator!='
   65 |    if (prev != x - y) {
      |        ~~~~~^~~~~~~~
dna.cpp:70:15: error: overloaded function with no contextual type information
   70 |    prev = x - y;
      |               ^
dna.cpp:59:15: warning: unused variable 'prv' [-Wunused-variable]
   59 |  int res = 0, prv = 0;
      |               ^~~