QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#101350#5254. DifferencesDestroyXuanQuang#WA 616ms17980kbC++141.3kb2023-04-29 10:56:342023-04-29 10:56:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-29 10:56:35]
  • 评测
  • 测评结果:WA
  • 用时:616ms
  • 内存:17980kb
  • [2023-04-29 10:56:34]
  • 提交

answer

#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <ctime>        
#include <cstdlib>
#include <utility>       
int n, m, k;
int cnt[100005][4];  
std::vector <std::pair <std::string, int> > a; 

int main () {
  std::srand (unsigned(std::time(0)));
  std::cin >> n >> m >> k;
  a.resize(n); 
  for (int i = 0; i < n; i++) {
    std::string s; 
    std::cin >> s;
    a[i] = std::make_pair(s, i);  
  }
  std::random_shuffle(a.begin(), a.end()); 
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      cnt[j][a[i].first[j] - 'A']++; 
    }
  }
  for (int i = 0; i < n; i++) {
    long long totalDiff = 0; 
    for (int j = 0; j < m; j++) {
      totalDiff += (long long) (n - cnt[j][a[i].first[j] - 'A']); 
    }
    if (totalDiff != (long long) (n - 1) * k) {
      continue; 
    }
    bool check = true; 
    for (int x = 0; x < i; x++) {
      if (x != i) {
        int numbDiff = 0; 
        for (int j = 0; j < m; j++) {
          if (a[i].first[j] != a[x].first[j]) {
            numbDiff++; 
          }
        }
        if (numbDiff != k) {
          check = false;
          break; 
        }
      }
    }
    if (check == true) {
      std::cout << a[i].second + 1; 
      return 0; 
    }
  }
  return 0; 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 616ms
memory: 17980kb

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:

3087

result:

wrong answer 1st lines differ - expected: '1397', found: '3087'