제출 #1275452

#제출 시각아이디문제언어결과실행 시간메모리
1275452chanhchuong123Lozinke (COCI17_lozinke)C++20
100 / 100
495 ms17080 KiB
#include<bits/stdc++.h> using namespace std; const bool multiTest = false; #define task "C" #define fi first #define se second #define MASK(i) (1LL << (i)) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define BIT(mask, i) ((mask) >> (i) & 1) template<typename T1, typename T2> bool minimize(T1 &a, T2 b) { if (a > b) a = b; else return 0; return 1; } template<typename T1, typename T2> bool maximize(T1 &a, T2 b) { if (a < b) a = b; else return 0; return 1; } const int MAX = 20020; int n; string s[MAX]; map<string, int> myMap; void process(void) { cin >> n; for (int i = 1; i <= n; ++i) { cin >> s[i]; } int ans = 0; for (int _ = 0; _ < 2; ++_) { for (int i = 1; i <= n; ++i) { vector<string> temp; for (int l = 0; l < int(s[i].size()); ++l) { string cur = ""; for (int r = l; r < int(s[i].size()); ++r) { cur += s[i][r]; temp.push_back(cur); } } sort(all(temp)); temp.resize(unique(all(temp)) - temp.begin()); for (string &s: temp) { ans += myMap[s]; } ++myMap[s[i]]; } reverse(s + 1, s + 1 + n); myMap.clear(); } cout << ans; } int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); if (fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } int nTest = 1; if (multiTest) cin >> nTest; while (nTest--) { process(); } return 0; }

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

lozinke.cpp: In function 'int main()':
lozinke.cpp:58:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |                 freopen(task".inp", "r",  stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
lozinke.cpp:59:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 |                 freopen(task".out", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...