제출 #716251

#제출 시각아이디문제언어결과실행 시간메모리
716251kidlinDNA 돌연변이 (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define int long long #define endul endl using namespace std; const int val = 1e3+5; const int inf = 2*(1e9+5); const int mod = 1000000007; int a[val]; int b[val string s,t; void init(string a,string b){ s=a,t=b; } int get_distance(int x, int y) { int T0=0,C0=0,A0=0,T1=0,A1=0,C1=0; int res=0; for(int j=x; j<=y; j++) { if(s[j]=='T') T0++; if(s[j]=='C') C0++; if(s[j]=='A') A0++; if(t[j]=='T') T1++; if(t[j]=='C') C1++; if(t[j]=='A') A1++; if(s[j]!=t[j]) res++; } if(T0!=T1 || C0!=C1 || A1!=A0)return -1; if(res%2==0) return res/2 ; return res/2+1 ; }

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

dna.cpp:9:10: error: expected ']' before 'string'
    9 | int b[val
      |          ^
      |          ]
   10 | string s,t;
      | ~~~~~~    
dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:12:5: error: 's' was not declared in this scope
   12 |     s=a,t=b;
      |     ^
dna.cpp:12:9: error: 't' was not declared in this scope
   12 |     s=a,t=b;
      |         ^
dna.cpp: In function 'long long int get_distance(long long int, long long int)':
dna.cpp:20:16: error: 's' was not declared in this scope
   20 |             if(s[j]=='T') T0++;
      |                ^
dna.cpp:21:16: error: 's' was not declared in this scope
   21 |             if(s[j]=='C') C0++;
      |                ^
dna.cpp:22:16: error: 's' was not declared in this scope
   22 |             if(s[j]=='A') A0++;
      |                ^
dna.cpp:23:16: error: 't' was not declared in this scope
   23 |             if(t[j]=='T') T1++;
      |                ^
dna.cpp:24:16: error: 't' was not declared in this scope
   24 |             if(t[j]=='C') C1++;
      |                ^
dna.cpp:25:16: error: 't' was not declared in this scope
   25 |             if(t[j]=='A') A1++;
      |                ^
dna.cpp:26:16: error: 's' was not declared in this scope
   26 |             if(s[j]!=t[j]) res++;
      |                ^
dna.cpp:26:22: error: 't' was not declared in this scope
   26 |             if(s[j]!=t[j]) res++;
      |                      ^