이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
#include "dna.h"
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
#define VV(vvvv,NNNN,xxxx); REP(i,0,NNNN) {vvvv.pb(xxxx);}
ll mod=1000000007LL;
template<class A=ll>
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}
template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}}
vector<ll> ZAB, ZBA, ZAC, ZCA, ZBC, ZCB; ll N;
vector<ll> A,B,C;
void init(string a, string b)
{
N=a.size();
ll curZAB=0LL,curZBA=0LL,curZAC=0LL,curZCA=0LL,curZBC=0LL,curZCB=0LL,difA=0LL, difB=0LL, difC=0LL;
REP(i,0,N)
{
if(a[i]=='A' && b[i]=='T') {curZAB++;}
else if(a[i]=='T' && b[i]=='A') {curZBA++;}
else if(a[i]=='A' && b[i]=='C') {curZAC++;}
else if(a[i]=='C' && b[i]=='A') {curZCA++;}
else if(a[i]=='T' && b[i]=='C') {curZBC++;}
else if(a[i]=='C' && b[i]=='T') {curZCB++;}
if(a[i]=='A') {difA++;} else if(a[i]=='T') {difB++;} else {difC++;}
if(b[i]=='A') {difA--;} else if(b[i]=='T') {difB--;} else {difC--;}
ZAB.pb(curZAB); ZBA.pb(curZBA); ZAC.pb(curZAC); ZCA.pb(curZCA); ZBC.pb(curZBC); ZCB.pb(curZCB);
A.pb(difA); B.pb(difB); C.pb(difC);
}
}
ll psAB(ll l, ll r) {if(l==0) {return ZAB[r];} else {return (ZAB[r]-ZAB[l-1]);}}
ll psBA(ll l, ll r) {if(l==0) {return ZBA[r];} else {return (ZBA[r]-ZBA[l-1]);}}
ll psAC(ll l, ll r) {if(l==0) {return ZAC[r];} else {return (ZAC[r]-ZAC[l-1]);}}
ll psCA(ll l, ll r) {if(l==0) {return ZCA[r];} else {return (ZCA[r]-ZCA[l-1]);}}
ll psBC(ll l, ll r) {if(l==0) {return ZBC[r];} else {return (ZBC[r]-ZBC[l-1]);}}
ll psCB(ll l, ll r) {if(l==0) {return ZCB[r];} else {return (ZCB[r]-ZCB[l-1]);}}
ll psA(ll l, ll r) {if(l==0) {return A[r];} else {return (A[r]-A[l-1]);}}
ll psB(ll l, ll r) {if(l==0) {return B[r];} else {return (B[r]-B[l-1]);}}
ll psC(ll l, ll r) {if(l==0) {return C[r];} else {return (C[r]-C[l-1]);}}
int get_distance(int x, int y)
{
if(psA(x,y)!=0 || psB(x,y)!=0 || psC(x,y)!=0) {return -1;}
return (2*max(psAB(x,y),psBA(x,y))-min(psAB(x,y),psBA(x,y))+min(psAC(x,y),psCA(x,y))+min(psBC(x,y),psCB(x,y)));
}
컴파일 시 표준 에러 (stderr) 메시지
dna.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
5 | #pragma GCC optimization ("O3")
|
dna.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
6 | #pragma GCC optimization ("unroll-loops")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |