제출 #952347

#제출 시각아이디문제언어결과실행 시간메모리
952347woodMutating DNA (IOI21_dna)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p32; typedef pair<ll, ll> p64; #define pb push_back #define eb emplace_back #define fi first #define se second #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define MOD %1000000007 vector<ll> pref_b; vector<ll> pref_a; vector<ll> pref_b2; vector<ll> pref_a2; vector<ll> matchpref; void init(string a, string b) { ll n = a.size(); pref_a.resize(n+1); pref_b.resize(n+1); pref_a2.resize(n+1); pref_b2.resize(n+1); matchpref.resize(n+1); for (size_t i = 0; i < a.size(); i++) { pref_a[i + 1] = pref_a[i] + (a[i] == 'A'); pref_b[i + 1] = pref_b[i] + (b[i] == 'A'); pref_a2[i + 1] = pref_a2[i] + (a[i] == 'T'); pref_b2[i + 1] = pref_b2[i] + (b[i] == 'T'); matchpref[i + 1] = matchpref[i]+(((a[i] == 'A') && (b[i] != 'A'))||((a[i]=='T')&&(b[i]=='C'))); } } ll get_distance(int x, int y) { if ((pref_a[y + 1] - pref_a[x] != pref_b[y + 1] - pref_b[x])||(pref_a2[y+1]-pref_a2[x]!= pref_b2[y+1]-pref_b2[x])) { return -1; } else return (matchpref[y + 1] - matchpref[x]); } #ifndef ONLINE_JUDGE int main() { freopen("input.in", "r", stdin); freopen("input.out", "w", stdout); fast_cin(); string s1,s2; cin>>s1>>s2; init(s1,s2); cout<<get_distance(0,1)<<'\n'; return 0; } #endif

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

dna.cpp: In function 'int main()':
dna.cpp:44:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |     freopen("input.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
dna.cpp:45:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |     freopen("input.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccbCzBKf.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc1hTP9e.o:dna.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status