제출 #591775

#제출 시각아이디문제언어결과실행 시간메모리
591775triplem5dsDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
///code be weshen zyk :) #include "dna.h" #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,fma") using namespace std; #include <bits/stdc++.h> using ll = long long; using ii = pair<ll, ll>; #define pb push_back #define F first #define S second #define f(i, a, b) for (ll i = a; i < b; i++) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define sz(x) (ll)(x).size() #define mp(x, y) make_pair(x, y) #define popCnt(x) (__builtin_popcountll(x)) #define LSB(x) (__builtin_ffsll(x) - 1) #define MSB(x) (64 - __builtin_clzll(x) - 1) #define int ll mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count()); const int N = 1e5 + 5, LG = log2(N) + 1, MOD = 1e9 + 7; int get(char c) { if(c == 'A') return 0; if(c == 'C') return 1; return 2; } int cnt[N][3][3]; void init(std::string a, std::string b) { int n= a.size(); for(int i = 0; i < n; i++) { f(j,0,3)f(k,0,3) cnt[i + 1][j][k] = cnt[i][j][k]; cnt[i + 1][get(a[i])][get(b[i])] += 1; } } int get_distance(int x, int y) { int l = x, r = y; bool ok = true; int tmp[3][3] = {}; f(j,0,3) { int sum1 = 0, sum2 = 0; f(k,0,3) { sum1 += cnt[r+1][j][k] - cnt[l][j][k]; sum2 += cnt[r+1][k][j] - cnt[l][k][j]; tmp[j][k] = cnt[r+1][j][k] - cnt[l][j][k]; } ok &= sum1 == sum2; } if(!ok) { return -1; } int ans = 0; int x = min(tmp[0][1], tmp[1][0]); ans += x; tmp[0][1] -= x; tmp[1][0] -= x; int y = min(tmp[0][2], tmp[2][0]); ans += y; tmp[0][2] -= y; tmp[2][0] -= y; int z = min(tmp[1][2], tmp[2][1]); ans += z; tmp[1][2] -= z; tmp[2][1] -= z; int w = min({tmp[0][1],tmp[1][2],tmp[2][0]}); ans += 2 * w; tmp[0][1] -= w; tmp[1][2] -= w; tmp[2][0] -= w; int w2 = min({tmp[0][2],tmp[2][1],tmp[1][0]}); ans += 2 * w2; tmp[0][2] -= w2; tmp[2][1] -= w2; tmp[1][0] -= w2; f(i,0,3) f(j,0,3) { if(i==j)continue; ans += tmp[i][j]; } return ans; } //void doWork() { // // while(q--) { // int l, r; // cin >> l >> r; // // } // // // // //} //int32_t main() { //#ifdef ONLINE_JUDGE // ios_base::sync_with_stdio(0); // cin.tie(0); //#endif // ONLINE_JUDGE // int t = 1; //// cin >> t; // while (t--) { // doWork(); // } // return 0; //}

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

dna.cpp: In function 'll get_distance(ll, ll)':
dna.cpp:62:9: error: declaration of 'll x' shadows a parameter
   62 |     int x = min(tmp[0][1], tmp[1][0]);
      |         ^
dna.cpp:45:22: note: 'll x' previously declared here
   45 | int get_distance(int x, int y) {
      |                      ^
dna.cpp:65:9: error: declaration of 'll y' shadows a parameter
   65 |     int y = min(tmp[0][2], tmp[2][0]);
      |         ^
dna.cpp:45:29: note: 'll y' previously declared here
   45 | int get_distance(int x, int y) {
      |                             ^