QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#791553 | #5254. Differences | khanhtai | TL | 0ms | 0kb | C++23 | 1.7kb | 2024-11-28 19:29:29 | 2024-11-28 19:29:34 |
answer
#include<bits/stdc++.h>
#define pb push_back
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define TASKNAME "differences"
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("Ofast")
using namespace std;
const int MAXN = 1e5 + 9;
vector<vector<char>> str;
vector<int> ord;
int n, m, k, invalid[MAXN];
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 mt(seed);
main()
{
fast;
srand(time(NULL));
scanf("%d %d %d", &n, &m, &k);
str.resize(n);
FOR(i, 0, n - 1){
str[i].resize(m);
FOR(j, 0, m - 1){
scanf(" %c", &str[i][j]);
}
ord.pb(i);
}
shuffle(ord.begin(), ord.end(), default_random_engine(0));
FOR(i, 0, (int) ord.size() - 1){
bool ch = true;
if (invalid[i]) continue;
FOR(j, 0, (int) ord.size() - 1){
if (j == i) continue;
int same = 0, dif = 0;
FOR(t, 0, m - 1){
if (str[ord[i]][t] != str[ord[j]][t]) dif++;
else same++;
if (dif > k or same > m - k) {
invalid[j] = true;
invalid[i] = true;
ch = false;
break;
}
}
if (!ch) break;
}
if (ch) {
cout << ord[i] + 1<< endl;
exit(0);
}
}
}
/**
Warning:
Đọc sai đề???
Cận lmao
Code imple thiếu case nào không.
Limit.
**/
詳細信息
Test #1:
score: 0
Time Limit Exceeded
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...