답안 #1078685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078685 2024-08-28T04:26:18 Z khactrung1912 Lozinke (COCI17_lozinke) C++14
5 / 100
79 ms 2008 KB
#include <bits/stdc++.h>
using namespace std;

long long n, re;
vector<string> a;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	cin >> n;
	for (int i = 1; i <= n; i++) {
		string s;
		cin >> s;
		a.push_back(s);
	}
	if (n<=2000) {
		for (int i = 0; i < a.size(); i++) {
			for (int j = 0; j < a.size(); j++) {
				if (i==j) continue;
				if (a[i].size()>a[j].size()) {
					for (int k = 0; k < a[i].size()-a[j].size()+1; k++) {
						if (a[i].substr(0, k+1)==a[j]) {
							re++;
							break;
						}
					}
				}
				else if (a[i]==a[j]) re++;
			}
		}
		cout << re;
	}
	else cout << 0;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:18:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for (int i = 0; i < a.size(); i++) {
      |                   ~~^~~~~~~~~~
lozinke.cpp:19:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |    for (int j = 0; j < a.size(); j++) {
      |                    ~~^~~~~~~~~~
lozinke.cpp:22:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |      for (int k = 0; k < a[i].size()-a[j].size()+1; k++) {
      |                      ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Incorrect 3 ms 484 KB Output isn't correct
5 Incorrect 18 ms 532 KB Output isn't correct
6 Incorrect 31 ms 360 KB Output isn't correct
7 Incorrect 79 ms 576 KB Output isn't correct
8 Correct 49 ms 348 KB Output is correct
9 Incorrect 1 ms 992 KB Output isn't correct
10 Incorrect 1 ms 992 KB Output isn't correct
11 Incorrect 2 ms 1012 KB Output isn't correct
12 Incorrect 2 ms 1244 KB Output isn't correct
13 Incorrect 3 ms 1756 KB Output isn't correct
14 Incorrect 3 ms 1756 KB Output isn't correct
15 Incorrect 3 ms 2008 KB Output isn't correct
16 Incorrect 2 ms 1756 KB Output isn't correct
17 Incorrect 2 ms 1620 KB Output isn't correct
18 Incorrect 2 ms 1752 KB Output isn't correct
19 Incorrect 3 ms 1756 KB Output isn't correct
20 Incorrect 2 ms 1756 KB Output isn't correct