제출 #437918

#제출 시각아이디문제언어결과실행 시간메모리
437918HaidaraDNA 돌연변이 (IOI21_dna)C++17
0 / 100
48 ms4484 KiB
/* * * * * * * * * *
 *   ID: Haidara   *
 *   LANG: C++17   *
 *   PROB:         *
 * * * * * * * * * */
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,x,n) for(int i=x;i<n;i++)
#define FOR(i,n) rep(i,0,n)
#define per(i,x,n) for(int i=x;i>n;i--)
#define ROF(i,x) for(int i=x;i>=0;i--)
#define v(i) vector< i >
#define p(i,j) pair< i , j >
#define pii pair<int,int>
#define m(i,j) map< i , j >
#define pq(i) priority_queue< i >
#define ff first
#define all(x) x.begin(),x.end()
#define ss second
#define pp push_back
using namespace std;
const int mod=1e9+7;
const int maxn=100100;
int At[maxn],ta[maxn],tc[maxn],ct[maxn],ac[maxn],ca[maxn];
void init(string a, string b)
{
    FOR(i,a.size())
    {
        At[i+1]=At[i];
        ta[i+1]=ta[i];
        tc[i+1]=tc[i];
        ct[i+1]=ct[i];
        ac[i+1]=ac[i];
        ca[i+1]=ca[i];
        if(a[i]=='A')
        {
            if(b[i]=='T')
                At[i+1]++;
            else if(b[i]=='C')
                ac[i+1]++;
        }
        else if(a[i]=='T')
        {
            if(b[i]=='A')
                ta[i+1]++;
            else if(b[i]=='C')
                tc[i+1]++;
        }
        else if(a[i]=='C')
        {
            if(b[i]=='A')
                ca[i+1]++;
            else if(b[i]=='T')
                ct[i+1]++;
        }
    }
    return ;
}
int get_distance(int x, int y)
{
    y++;
    int ans=0;
    ans+=min(At[y]-At[x],ta[y]-ta[x]);
    ans+=abs(At[y]-At[x]-ta[y]+ta[x]);
    ans+=min(tc[y]-tc[x],ct[y]-ct[x]);
    ans+=abs(tc[y]-tc[x]-ct[y]+ct[x]);
    ans+=min(ac[y]-ac[x],ca[y]-ca[x]);
    ans+=abs(ac[y]-ac[x]-ca[y]+ca[x]);
    return ans-1;
}

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:8:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define rep(i,x,n) for(int i=x;i<n;i++)
      |                                 ^
dna.cpp:9:18: note: in expansion of macro 'rep'
    9 | #define FOR(i,n) rep(i,0,n)
      |                  ^~~
dna.cpp:27:5: note: in expansion of macro 'FOR'
   27 |     FOR(i,a.size())
      |     ^~~
#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...