Submission #168487

# Submission time Handle Problem Language Result Execution time Memory
168487 2019-12-13T09:20:19 Z RiscadoA Parametriziran (COCI19_parametriziran) C++14
11 / 110
3000 ms 888 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 50000;
const int MAX_M = 6;

int N, M;

int main() {
	cin >> N >> M;
	
	int c = 0;
	char words[MAX_N][MAX_M + 1];
	
	for (int i = 0; i < N; ++i) { // Read input O(NM)
		scanf("%s", words[i]);
	}
	
	// For every pair (a, b) - O(N^2 * M)
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			int valid = 1;
			for (int k = 0; k < M; ++k) {
				if (words[i][k] == '?' || words[j][k] == '?')
					continue;
				if (words[i][k] != words[j][k])
				{
					valid = 0;
					break;
				}
			}
			c += valid;
		}
	}
	
	cout << c;
	
	return 0;
}

Compilation message

parametriziran.cpp: In function 'int main()':
parametriziran.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", words[i]);
   ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2268 ms 812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1876 ms 656 KB Output is correct
2 Execution timed out 3046 ms 632 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3032 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1924 ms 688 KB Output is correct
2 Execution timed out 3055 ms 632 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3044 ms 760 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3020 ms 760 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3045 ms 888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2256 ms 816 KB Output is correct
2 Execution timed out 3052 ms 760 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3047 ms 632 KB Time limit exceeded
2 Halted 0 ms 0 KB -