Submission #577483

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5774832022-06-14 20:53:23keta_tsimakuridzeMutating DNA (IOI21_dna)C++17
100 / 100
83 ms7380 KiB
#include "dna.h"'
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int tree[N][3][3], n;
void upd(int id, int t1, int t2) {
++id;
for(id; id <= n; id += id & (-id)) tree[id][t1][t2] ++;
}
int get(int id, int t1, int t2) {
++id;
int ans = 0;
for(id; id >= 1; id -= id & (-id)) ans += tree[id][t1][t2];
return ans;
}
void init(std::string a, std::string b) {
n = a.size();
for(int i = 0; i < n; i++) {
upd(i, (a[i] == 'A' ? 1 : a[i] == 'C' ? 0 : 2), (b[i] == 'A' ? 1 : b[i] == 'C' ? 0 : 2));
}
}
int get_distance(int x, int y) {
vector<vector<int> > a;
a.resize(3, vector<int> (3));
int ans = 0;
vector<int> X(3);
for(int t1 = 0; t1 < 3; t1++) {
for(int t2 = 0; t2 < 3; t2++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

dna.cpp:1:17: warning: missing terminating ' character
    1 | #include "dna.h"'
      |                 ^
dna.cpp:1:17: warning: extra tokens at end of #include directive
dna.cpp: In function 'void upd(int, int, int)':
dna.cpp:8:6: warning: statement has no effect [-Wunused-value]
    8 |  for(id; id <= n; id += id & (-id)) tree[id][t1][t2] ++;
      |      ^~
dna.cpp: In function 'int get(int, int, int)':
dna.cpp:13:6: warning: statement has no effect [-Wunused-value]
   13 |  for(id; id >= 1; id -= id & (-id)) ans += tree[id][t1][t2];
      |      ^~
#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...