제출 #483704

#제출 시각아이디문제언어결과실행 시간메모리
483704tredsused70DNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
using namespace std; #define accelerator ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define fi first #define se second #define pb push_back typedef long long ll; typedef unsigned long long ull; typedef long double ld; const int nmax=200011,mod=1000000007,inf=2000010000,key=200003; const ll infll=4000000000000000000; const ld eps=1e-7; void init() { return ; } string a,b; int cntc[nmax][3]={0},mas1[nmax]={0},mas2[nmax]={0},cnt[nmax][3][3]={0}; void cnv(string &s,int mas[]) { int n=s.size(); for(int i=0;i<n;i++) { if(s[i]=='A') { mas[i+1]=0; continue; } if(s[i]=='T') mas[i+1]=1; else mas[i+1]=2; } return ; } void init(string &a,string &b) { cnv(a,mas1); cnv(b,mas2); int n=a.size(); for(int i=0;i<n;i++) { for(int j=0;j<3;j++) cntc[i+1][j]=cntc[i][j]; cntc[i+1][mas1[i+1]]++; cntc[i+1][mas2[i+1]]--; for(int j=0;j<3;j++) for(int k=0;k<3;k++) cnt[i+1][j][k]=cnt[i][j][k]; cnt[i+1][mas1[i+1]][mas2[i+1]]++; } return ; } int count_swaps(int mas[3][3]) { int ans=0,t; for(int i=0;i<3;i++) { mas[i][i]=0; for(int j=i+1;j<3;j++) { t=min(mas[i][j],mas[j][i]); ans+=t; mas[i][j]-=t; mas[j][i]-=t; } } t=0; for(int i=0;i<3;i++) for(int j=0;j<3;j++) t+=mas[i][j]; ans+=2*t/3; return ans; } int get_distance(int l,int r) { r++; for(int i=0;i<3;i++) { if(cntc[l][i]!=cntc[r][i]) return -1; } int cntt[3][3]; for(int i=0;i<3;i++) for(int j=0;j<3;j++) { cntt[i][j]=cnt[r][i][j]; cntt[i][j]-=cnt[l][i][j]; } return count_swaps(cntt); }

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

dna.cpp:19:1: error: 'string' does not name a type
   19 | string a,b;
      | ^~~~~~
dna.cpp:22:6: error: variable or field 'cnv' declared void
   22 | void cnv(string &s,int mas[])
      |      ^~~
dna.cpp:22:10: error: 'string' was not declared in this scope
   22 | void cnv(string &s,int mas[])
      |          ^~~~~~
dna.cpp:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | using namespace std;
dna.cpp:22:18: error: 's' was not declared in this scope; did you mean 'se'?
   22 | void cnv(string &s,int mas[])
      |                  ^
      |                  se
dna.cpp:22:20: error: expected primary-expression before 'int'
   22 | void cnv(string &s,int mas[])
      |                    ^~~
dna.cpp:40:6: error: variable or field 'init' declared void
   40 | void init(string &a,string &b)
      |      ^~~~
dna.cpp:40:11: error: 'string' was not declared in this scope
   40 | void init(string &a,string &b)
      |           ^~~~~~
dna.cpp:40:11: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
dna.cpp:40:19: error: 'a' was not declared in this scope
   40 | void init(string &a,string &b)
      |                   ^
dna.cpp:40:21: error: 'string' was not declared in this scope
   40 | void init(string &a,string &b)
      |                     ^~~~~~
dna.cpp:40:21: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
dna.cpp:40:29: error: 'b' was not declared in this scope; did you mean 'pb'?
   40 | void init(string &a,string &b)
      |                             ^
      |                             pb
dna.cpp: In function 'int count_swaps(int (*)[3])':
dna.cpp:67:15: error: 'min' was not declared in this scope
   67 |             t=min(mas[i][j],mas[j][i]);
      |               ^~~