이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("unroll-loops,Ofast,O3")
#pragma GCC target("avx,avx2,fma")
#define F first
#define int short
#define S second
#define sz(x) (int)x.size()
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define NFS ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
typedef long long ll;
const long long inf = 1e18+777;
const int N = 4102;
const bool I = 1;
int n, m, k;
char a[N][N];
bitset<N> bin[4][N];
int cnt[2][N];
int sum[N][N];
int get(char a){
if(a == 'A') return 0;
if(a == 'C') return 1;
if(a == 'G') return 2;
return 3;
}
signed main(){
NFS;
cin >> n >> m >> k;
for(int i = 1; i <= n; ++i){
for(int j = 0; j < m; ++j){
cin >> a[i][j];
bin[get(a[i][j])][i][j] = true;
}
cnt[0][i] = bin[0][i].count();
cnt[1][i] = bin[1][i].count();
cnt[2][i] = bin[2][i].count();
cnt[3][i] = bin[3][i].count();
}
vector <int> v;
for(int i = 1; i <= n; ++i){
v.pb(i);
}
srand(time(0));
random_shuffle(all(v));
random_shuffle(all(v));
for(int i : v){
bool ok = true;
for(int j : v){
if(i == j) continue;
if(sum[i][j] == 0){
for(int x = 0; x < 4; ++x){
sum[i][j] += cnt[x][i] - (bin[x][i] & bin[x][j]).count();
if(sum[i][j] > k){
break;
}
}
sum[j][i] = sum[i][j];
if(sum[i][j] != k){
ok = false;
break;
}
}else{
if(sum[i][j] != k){
ok = false;
break;
}
}
}
if(ok){
cout << i;
return 0;
}
}
};
컴파일 시 표준 에러 (stderr) 메시지
genetics.cpp: In function 'int main()':
genetics.cpp:40:8: warning: array subscript 2 is above array bounds of 'short int [2][4102]' [-Warray-bounds]
40 | cnt[2][i] = bin[2][i].count();
| ~~~~~^
genetics.cpp:22:5: note: while referencing 'cnt'
22 | int cnt[2][N];
| ^~~
genetics.cpp:41:8: warning: array subscript 3 is above array bounds of 'short int [2][4102]' [-Warray-bounds]
41 | cnt[3][i] = bin[3][i].count();
| ~~~~~^
genetics.cpp:22:5: note: while referencing 'cnt'
22 | int cnt[2][N];
| ^~~
# | 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... |