제출 #437916

#제출 시각아이디문제언어결과실행 시간메모리
437916HaidaraMutating DNA (IOI21_dna)C++17
컴파일 에러
0 ms0 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 int long long #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; void SIO(string name="") { if(name!="") { freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } } const int inf=1LL<<62LL; 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]); cout<<ans-1; }

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:9:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | #define rep(i,x,n) for(int i=x;i<n;i++)
      |                                 ^
dna.cpp:10:18: note: in expansion of macro 'rep'
   10 | #define FOR(i,n) rep(i,0,n)
      |                  ^~~
dna.cpp:37:5: note: in expansion of macro 'FOR'
   37 |     FOR(i,a.size())
      |     ^~~
dna.cpp: In function 'long long int get_distance(long long int, long long int)':
dna.cpp:80:1: warning: no return statement in function returning non-void [-Wreturn-type]
   80 | }
      | ^
dna.cpp: In function 'void SIO(std::string)':
dna.cpp:27:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         freopen((name+".in").c_str(),"r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dna.cpp:28:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         freopen((name+".out").c_str(),"w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc7quvQt.o: in function `main':
grader.cpp:(.text.startup+0x39d): undefined reference to `get_distance(int, int)'
collect2: error: ld returned 1 exit status