제출 #1078668

#제출 시각아이디문제언어결과실행 시간메모리
1078668khactrung1912Lozinke (COCI17_lozinke)C++14
0 / 100
2 ms524 KiB
#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(); freopen("PASS.INP", "r", stdin); freopen("PASS.OUT", "w", stdout); 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; }

컴파일 시 표준 에러 (stderr) 메시지

lozinke.cpp: In function 'int main()':
lozinke.cpp:20: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]
   20 |   for (int i = 0; i < a.size(); i++) {
      |                   ~~^~~~~~~~~~
lozinke.cpp:21: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]
   21 |    for (int j = 0; j < a.size(); j++) {
      |                    ~~^~~~~~~~~~
lozinke.cpp:24:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |      for (int k = 0; k < a[i].size()-a[j].size()+1; k++) {
      |                      ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
lozinke.cpp:11:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  freopen("PASS.INP", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
lozinke.cpp:12:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  freopen("PASS.OUT", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...