답안 #473560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473560 2021-09-15T16:42:03 Z Blobo2_Blobo2 Alternating Current (BOI18_alternating) C++17
0 / 100
1220 ms 11560 KB
/*
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,tune=native")
#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 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;
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++){
                if(dna[i][j] == 'A')
                    a[i][j] =0;
                else
                    a[i][j] =1;
            }
        }
        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;
                ok = (a[all[i]] ^ a[good.back()]);
                if(ok.count() != k)
                    goto toooooooooooo;
            }
            cout<<good.back()+1;
            return 0;
            toooooooooooo:;
            good.pop_back();
        }
        cout<<good[0]+1;
    }
    return 0;
}

Compilation message

alternating.cpp:21:24: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   21 | const int mo=1e9+7,INF=1e18;
      |                        ^~~~
alternating.cpp: In function 'int main()':
alternating.cpp:51:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |             for(int i=0;i<all.size();i++){
      |                         ~^~~~~~~~~~~
alternating.cpp:80:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |             for(int i=0;i<all.size();i++){
      |                         ~^~~~~~~~~~~
alternating.cpp:83:31: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   83 |                 if(ok.count() != k)
      |                    ~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 320 KB 15 is not a string of length exactly 15
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 320 KB 15 is not a string of length exactly 15
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 320 KB 15 is not a string of length exactly 15
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1220 ms 11560 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 320 KB 15 is not a string of length exactly 15
2 Halted 0 ms 0 KB -