Submission #853490

#TimeUsernameProblemLanguageResultExecution timeMemory
853490Trisanu_DasGenetics (BOI18_genetics)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int P = 9949, Q = int(1e9) + 9;

int n, m, k;
char s[N][N];
int c[5][N], p[N], r;
 
signed main(){
    cin >> n >> m >> k; int t = 1;
    for(int i = 1; i <= n; i++){
        cin >> s[i];
        for(int j = 0; j < m; j++){
            s[i][j] = (s[i][j] == 'A' ? 1 : s[i][j] == 'C' ? 2 : s[i][j] == 'G' ? 3 : 4);
            c[s[i][j]][j] = (c[s[i][j]][j] + t) % Q;
            c[0][j] = (c[0][j] + t) % Q;
        }
        r = (r + t * k) % Q;
        p[i] = t;
        t = t * P % Q;
    }
    for(int i = 1; i <= n; i++){
        int t = 0;
        for(int j = 0; j < m; j++) t = (t + c[0][j] - c[s[i][j]][j] + Q) % Q;
        if((t + p[i] * k) % Q == r){ cout << i << '\n'; return 0; }
    }
}

Compilation message (stderr)

genetics.cpp:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
genetics.cpp:5:25: note: in expansion of macro 'int'
    5 | const int P = 9949, Q = int(1e9) + 9;
      |                         ^~~
genetics.cpp:8:8: error: 'N' was not declared in this scope
    8 | char s[N][N];
      |        ^
genetics.cpp:8:11: error: 'N' was not declared in this scope
    8 | char s[N][N];
      |           ^
genetics.cpp:9:10: error: 'N' was not declared in this scope
    9 | int c[5][N], p[N], r;
      |          ^
genetics.cpp:9:16: error: 'N' was not declared in this scope
    9 | int c[5][N], p[N], r;
      |                ^
genetics.cpp: In function 'int main()':
genetics.cpp:14:16: error: 's' was not declared in this scope
   14 |         cin >> s[i];
      |                ^
genetics.cpp:17:13: error: 'c' was not declared in this scope
   17 |             c[s[i][j]][j] = (c[s[i][j]][j] + t) % Q;
      |             ^
genetics.cpp:21:9: error: 'p' was not declared in this scope
   21 |         p[i] = t;
      |         ^
genetics.cpp:26:45: error: 'c' was not declared in this scope
   26 |         for(int j = 0; j < m; j++) t = (t + c[0][j] - c[s[i][j]][j] + Q) % Q;
      |                                             ^
genetics.cpp:26:57: error: 's' was not declared in this scope
   26 |         for(int j = 0; j < m; j++) t = (t + c[0][j] - c[s[i][j]][j] + Q) % Q;
      |                                                         ^
genetics.cpp:27:17: error: 'p' was not declared in this scope
   27 |         if((t + p[i] * k) % Q == r){ cout << i << '\n'; return 0; }
      |                 ^