이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
Editor: Abdelrahman Hossam
Nickname: Blobo2_Blobo2
IOI next year isA :)
*/
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
#include<bits/stdc++.h>
using namespace std;
//#define int long long
//#define int __int16_t
#define endl "\n"
#define all(v) v.begin(),v.end()
#define gen(arr,n,nxt) generate(arr,arr+n,nxt)
#define Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty ios_base::sync_with_stdio(false);cin.tie(0);
#define EPS 0.00000001
const int mo=1e9+7,INF=1e18;
int nxt(){int x;cin>>x;return x;}
int rand(int l, int r){
static mt19937
rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<int> ludo(l, r);
return ludo(rng);
}
bitset<4100>ok;
//bitset<4100> a[4100];
vector<int>good,all;
bool vis[4100][4100];
unsigned long long a[4100][65];
int GETA(int x,int y){
int CNT=0;
for(int i=0;i<65;i++)
CNT+=__builtin_popcountll((a[x][i]^a[y][i]));
return CNT;
}
signed main(){
Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty
//freopen("in.txt","r",stdin);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n=nxt(),m=nxt(),k=nxt();
string dna[n];
bool hacheck_keda_7aga_bas = 0;
for(int i=0;i<n;i++){
cin>>dna[i];
hacheck_keda_7aga_bas |= count(all(dna[i]),'G');
hacheck_keda_7aga_bas |= count(all(dna[i]),'T');
}
if(hacheck_keda_7aga_bas){
for(int i=0;i<n;i++)
good.push_back(i),all.push_back(i);
while(good.size()>1){
shuffle(all(good),rng);
shuffle(all(all),rng);
for(int i=0;i<all.size();i++){
if(good.back() == all[i])continue;
int ok=0;
for(int a=0;a<m;a++)
ok += (dna[all[i]][a] != dna[good.back()][a]);
if(ok != k)
goto tooooooooooo;
}
cout<<good.back()+1;
return 0;
tooooooooooo:;
good.pop_back();
}
cout<<good[0]+1;
}
else{
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
unsigned long long z=((unsigned long long)1<<j%64);
if(dna[i][j] == 'C')
a[i][j/64] |=z;
}
}
for(int i=0;i<n;i++)
good.push_back(i),all.push_back(i);
while(good.size()>1){
shuffle(all(good),rng);
shuffle(all(all),rng);
for(int i=0;i<all.size();i++){
if(good.back() == all[i])continue;
if(vis[all[i]][good.back()])continue;
if(GETA(all[i],good.back()) != k)
goto toooooooooooo;
vis[all[i]][good.back()]=1;
vis[good.back()][all[i]]=1;
}
cout<<good.back()+1;
return 0;
toooooooooooo:;
good.pop_back();
}
cout<<good[0]+1;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
genetics.cpp:22:24: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
22 | const int mo=1e9+7,INF=1e18;
| ^~~~
genetics.cpp: In function 'int main()':
genetics.cpp:60:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
60 | for(int i=0;i<all.size();i++){
| ~^~~~~~~~~~~
genetics.cpp:88:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
88 | for(int i=0;i<all.size();i++){
| ~^~~~~~~~~~~
# | 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... |