제출 #535192

#제출 시각아이디문제언어결과실행 시간메모리
535192DJ035DNA 돌연변이 (IOI21_dna)C++17
100 / 100
56 ms15628 KiB
#include "dna.h" #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") #include <bits/stdc++.h> #define MEM 222222 #define sanic ios_base::sync_with_stdio(0) #define x first #define y second #define pf push_front #define pb push_back #define all(v) v.begin(), v.end() #define sz size() using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll INF = 1e17+7; const ll MOD = 998244353; ll gcd(ll a, ll b){ if(a%b) return gcd(b, a%b); return b; } ll n,m; ll aa[MEM][3], bb[MEM][3]; ll cc[MEM][3][3]; string c, d; void init(std::string a, std::string b) { for(int i=0; i<a.sz; i++){ aa[i+1][0] = aa[i][0] + (a[i]=='A'); aa[i+1][1] = aa[i][1] + (a[i]=='C'); aa[i+1][2] = aa[i][2] + (a[i]=='T'); } for(int i=0; i<b.sz; i++){ bb[i+1][0] = bb[i][0] + (b[i]=='A'); bb[i+1][1] = bb[i][1] + (b[i]=='C'); bb[i+1][2] = bb[i][2] + (b[i]=='T'); } for(int i=0; i<b.sz; i++){ for(int j=0; j<3; j++) for(int k=0; k<3; k++) cc[i+1][j][k] = cc[i][j][k]; ll x=(a[i]=='A' ? 0:(a[i]=='C'?1:2)); ll y=(b[i]=='A' ? 0:(b[i]=='C'?1:2)); cc[i+1][x][y]++; } } int get_distance(int x, int y) { for(int i=0; i<3; i++) if(aa[y+1][i]-aa[x][i]!=bb[y+1][i]-bb[x][i]) return -1; ll d[3][3]; for(int i=0; i<3; i++) for(int j=0; j<3; j++) d[i][j] = cc[y+1][i][j]-cc[x][i][j]; /* for(int i=0; i<3; i++) for(int j=0; j<3; j++) if(i!=j)cout << i << ' ' << j << ' ' << d[i][j] << '\n'; */ ll ans = 2*(d[0][1]+d[1][0])-3*min(d[1][0], d[0][1])+min(d[0][2], d[2][0])+min(d[1][2],d[2][1]); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=0; i<a.sz; i++){
      |                   ^
dna.cpp:34:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i=0; i<b.sz; i++){
      |                   ^
dna.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     for(int i=0; i<b.sz; i++){
      |                   ^
#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...