| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 116825 | Licht | Lozinke (COCI17_lozinke) | C++14 | 480 ms | 16608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define vt vector
#define pb push_back
#define pob pop_back
#define vi vt<int>
#define vvi vt<vi>
#define vii vt<ii>
#define vvii vt<vii>
typedef long long ll;
#define For(i,a,b) for(int i = a; i < b; i++)
#define foR(i,a,b) for(int i = a; i <= b; i++)
#define roF(i,a,b) for(int i = a - 1; i >= b; i--)
#define Rof(i,a,b) for(int i = a; i >= b; i--)
vector<string> v;
map<string,int> dx;
map<string,bool> dc;
bool cmp(string a, string b){
return a.size() < b.size();
}
signed main (){
/*
freopen(".inp","r",stdin);
freopen(".out","w",stdout);
*/
int n, coun = 0; cin >> n;
string t;
For(i,0,n){
cin >> t;
v.pb(t);
}
sort(v.begin(),v.end(),cmp);
For(i,0,n){
// cout << v[i] << "\n";
dc.clear();
//nc
For(j,0,v[i].size()){
string temp;
For(k,j,v[i].size()){
temp += v[i][k];
if((!dc[temp]) && dx[temp]){
dc[temp] = true;
coun+=dx[temp];
}
}
}
coun+=dx[v[i]];
dx[v[i]]++;
// cout << coun << "\n";
}
cout << coun;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
