제출 #534768

#제출 시각아이디문제언어결과실행 시간메모리
534768Bogdan1110DNA 돌연변이 (IOI21_dna)C++17
100 / 100
43 ms8588 KiB
#include <bits/stdc++.h> #define FAST {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);} #define ll long long #define ull unsigned long long #define pb push_back #define fi first #define se second #define ld long double #define pii pair<int,int> #define pll pair<long long,long long> #define all(a) (a).begin(), (a).end() #define mp make_pair using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<ld, null_type,less<ld>, rb_tree_tag,tree_order_statistics_node_update> // order_of_key -> # less than k // find_by_order -> k-th element // pq max element void files() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } const double eps = 0.00000001; const int NMAX = 100010; const ll inf = LLONG_MAX/2; const ll modi = 998244353; int at[NMAX], ta[NMAX], ac[NMAX], ca[NMAX], ct[NMAX], tc[NMAX], a1[NMAX], a2[NMAX], b1[NMAX], b2[NMAX], c1[NMAX], c2[NMAX]; void init(string a, string b) { int n = a.size(); for (int i = 0; i < n ; i++ ) { if ( i ) { at[i] = at[i-1]; ta[i] = ta[i-1]; ca[i] = ca[i-1]; ac[i] = ac[i-1]; ct[i] = ct[i-1]; tc[i] = tc[i-1]; a1[i] = a1[i-1]; b1[i] = b1[i-1]; c1[i] = c1[i-1]; a2[i] = a2[i-1]; b2[i] = b2[i-1]; c2[i] = c2[i-1]; } if ( a[i] == 'A' ) a1[i]++; if ( a[i] == 'B' ) b1[i]++; if ( a[i] == 'C' ) c1[i]++; if ( b[i] == 'A' ) a2[i]++; if ( b[i] == 'B' ) b2[i]++; if ( b[i] == 'C' ) c2[i]++; if ( b[i] == 'A' && a[i] == 'T' ) at[i]++; if ( b[i] == 'T' && a[i] == 'A' ) ta[i]++; if ( b[i] == 'A' && a[i] == 'C' ) ac[i]++; if ( b[i] == 'C' && a[i] == 'A' ) ca[i]++; if ( b[i] == 'C' && a[i] == 'T' ) ct[i]++; if ( b[i] == 'T' && a[i] == 'C' ) tc[i]++; } } int get_distance(int l, int r) { if ( a1[r] - (l?a1[l-1]:0) != a2[r] - (l?a2[l-1]:0) ) return -1; if ( b1[r] - (l?b1[l-1]:0) != b2[r] - (l?b2[l-1]:0) ) return -1; if ( c1[r] - (l?c1[l-1]:0) != c2[r] - (l?c2[l-1]:0) ) return -1; int AT = at[r] - (l?at[l-1]:0); int TA = ta[r] - (l?ta[l-1]:0); int AC = ac[r] - (l?ac[l-1]:0); int CA = ca[r] - (l?ca[l-1]:0); int TC = tc[r] - (l?tc[l-1]:0); int CT = ct[r] - (l?ct[l-1]:0); int c = min(AT,TA) + min(AC,CA) + min(CT,TC); int u = AT + TA + AC + CA + CT + TC; return (2*u-c)/3; }

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

dna.cpp: In function 'void files()':
dna.cpp:25:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
dna.cpp:26:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...