답안 #117482

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
117482 2019-06-16T08:19:48 Z ckodser Genetics (BOI18_genetics) C++14
27 / 100
2000 ms 6264 KB
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}

#define ll int
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll maxn=4110;
const ll inf=1e9+800;
const ll mod=1e9+7;

string s[maxn];
bitset<maxn> bi[maxn][4];
ll n,m,k;

ll dif(ll i,ll j){
	ll ans=0;
	for(ll y=0;y<4;y++){
		ans+=(bi[i][y]^bi[j][y]).count();
	}
	return ans;
}
bool is_good(ll i,ll j){
	return (dif(i,j)==k);
}
bool isAns(ll a){
	for(ll i=0;i<n;i++){
		if(i!=a){
			if(!is_good(i,a)){
				return 0;
			}
		}
	}
	return 1;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);	
	cin>>n>>m>>k;
	k*=2;
	for(ll i=0;i<n;i++){
		cin>>s[i];
		for(ll j=0;j<m;j++){
			if(s[i][j]=='A')s[i][j]=0;
			if(s[i][j]=='C')s[i][j]=1;
			if(s[i][j]=='T')s[i][j]=2;
			if(s[i][j]=='G')s[i][j]=3;
			bi[i][s[i][j]][j]=1;
		}
	}
	for(ll i=0;i<n;i++){
		if(isAns(i)){
			cout<<i+1<<endl;
			return 0;
		}
	}

}

Compilation message

genetics.cpp: In function 'int main()':
genetics.cpp:106:17: warning: array subscript has type 'char' [-Wchar-subscripts]
    bi[i][s[i][j]][j]=1;
                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 10 ms 632 KB Output is correct
5 Correct 10 ms 652 KB Output is correct
6 Correct 10 ms 632 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 9 ms 632 KB Output is correct
10 Correct 8 ms 632 KB Output is correct
11 Correct 6 ms 632 KB Output is correct
12 Correct 16 ms 760 KB Output is correct
13 Correct 5 ms 632 KB Output is correct
14 Correct 6 ms 760 KB Output is correct
15 Correct 6 ms 632 KB Output is correct
16 Correct 5 ms 632 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2088 ms 6264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2088 ms 6264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
4 Correct 10 ms 632 KB Output is correct
5 Correct 10 ms 652 KB Output is correct
6 Correct 10 ms 632 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 9 ms 632 KB Output is correct
10 Correct 8 ms 632 KB Output is correct
11 Correct 6 ms 632 KB Output is correct
12 Correct 16 ms 760 KB Output is correct
13 Correct 5 ms 632 KB Output is correct
14 Correct 6 ms 760 KB Output is correct
15 Correct 6 ms 632 KB Output is correct
16 Correct 5 ms 632 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Execution timed out 2088 ms 6264 KB Time limit exceeded
19 Halted 0 ms 0 KB -