QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#791067#5254. DifferencesjackpionTL 0ms0kbC++201.7kb2024-11-28 16:40:442024-11-28 16:40:44

Judging History

你现在查看的是最新测评结果

  • [2024-11-28 16:40:44]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-11-28 16:40:44]
  • 提交

answer

//Link problem:
//Time limit: 1000ms
//Mem limit: 256mb
#include <bits/stdc++.h>
#define NAME "gen"

#define FOR(i,l,r) for (int i = l; l <= r; i++)
#define FOD(i,r,l) for (int i = r; i >= l; i--)

#define ii pair <int, int>
#define iii pair <int, ii>
#define iv pair <ii, ii>
#define vi vector <int>
#define vii vector <ii>
#define int long long
#define fi first
#define se second
#define pb push_back

#define oo 1e18
#define mod (int)(1e9 + 7)
using namespace std;
const int N = 1e5 + 10;
int n, m, k;
pair <string, int> s[N];
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(NAME".inp", "r")) {
        freopen(NAME".inp", "r", stdin);
        freopen(NAME".out", "w", stdout);
    }
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) {
        cin >> s[i].fi;
        s[i].se = i;
    }
    random_shuffle(s + 1, s + n + 1);
    for (int i = 1; i <= n; i++) {
        bool OK = true;
        for (int j = 1; j <= n; j++) {
            if(i == j) continue;
            int num = 0;
            for (int p = 0; p < m; p++) {
                if(s[i].fi[p] != s[j].fi[p])
                    num++;
            }
            if(num != k) {
                OK = false;
                break;
            }
        }
        if(OK) {
            cout << s[i].se;
            return 0;
        }
    }
    return 0;
}
/*
    - Cấu trúc dữ liệu, long long
    - Cẩn thận đáp án, code đúng mà không chú ý gây ra sai (in debug quên xóa)
    - Sinh test chưa?
    - Freopen chưa ?
    - Đặt đúng tên file chưa?
    - Đặt đúng tên thư mục chưa?
    - Kỹ vào nhé :D
    - Game 1 lần đấy, cẩn thận vào
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:


result: