제출 #612355

#제출 시각아이디문제언어결과실행 시간메모리
612355PanTkdDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
// // main.cpp // // Created by Panagiotis Chadjicostas on // Copyright © Panagiotis Hadjicostas. All rights reserved. // #include <iostream> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <fstream> #include <iomanip> #include <iterator> #include <limits> #include <list> #include <cstring> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #include <unordered_map> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> ii; #define fo(i,a,b) for(int i = a; i<=b; i++) #define f(i,b) for(int i=0;i<b;i++) #define F first #define S second #define sz size #define ls s,m,idx<<1 #define rs m+1,e,idx<<1|1 const ll MOD=ll(1e9)+7; const ll MAXN=2*ll(1e6); void checker(){ ll n=rand()%20+2; vi a(n,ll()); for(ll i=0;i<n;i++){ a[i]=rand()%20+2; } for(ll b=0;b<(1<<n);b++){ vi on,off; for(ll i=0;i<n;i++){ if(i&(1<<i)){ on.push_back(i); } else{ off.push_back(i); } } } } /////////////////////////////////////////////////////////////////////// vector<ll> pa,pb,pab; string ta,tb; ll k; void init(string a, string b){ ll n=a.size(); k=n; pa.assign(n+1,0); pb.assign(n+1,0); pab.assign(n+1,0); a='1'+a; b='1'+b; ta=a; tb=b; for(ll i=1;i<=n;i++){ pa[i]=pa[i-1]+(a[i]=='A'); pb[i]=pb[i-1]+(b[i]=='A'); pab[i]=pab[i-1]+(a[i]!=b[i]); } } int get_distance(int x, int y){ string p,s; x++,y++; multiset<char> s1,s2; for(ll i=x;i<=y;i++){ p+=ta[i]; s+=tb[i]; } string pp=p,ss=s; sort(pp.begin(),pp.end()); sort(ss.begin(),ss.end()); if(p==s) return 0; if(pp!=ss){ return -1; } for(ll i=0;i<y-x+1;i++) if(p[i]==s[i]) return 1; else return 2; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n,q; cin>>n>>q; string a,b;cin>>a>>b; init(a,b); while(q--){ ll x,y;cin>>x>>y; cout<<get_distance(x,y)<<endl; } return 0; }

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

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:83:12: warning: control reaches end of non-void function [-Wreturn-type]
   83 |     string p,s;
      |            ^
/usr/bin/ld: /tmp/ccvZVj9i.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccmSuWSg.o:dna.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status