# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
928055 | xad | Lozinke (COCI17_lozinke) | C++14 | 148 ms | 2348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nn "\n"
#define x_x ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define intt int _; cin >> _; while (_--)
#define emp push_back
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ld long double
#define A first
#define B second
typedef long long ll;
const ld eps = 1e-27;
// diff between decimals 0.000000001 mt19937 mt(time(nullptr));
int fx[]={1,-1,0,0}, fy[]={0,0,1,-1};
int main() {
/*freopen("measurement.in","r",stdin);
freopen("measurement.out","w", stdout);*/
x_x
int n; cin>>n; string ar[n]; map<string,int>mp;
for (auto&i:ar) cin>>i, mp[i]++;
ll ans=0;
for (int i=0; i<n; i++ ){
mp[ar[i]]--; map<string,bool>M;
for (int j=1; j<=ar[i].size(); j++) {
for (int k=0; (k+j)<=ar[i].size(); k++) {
if (M.find(ar[i].substr(k,j))==M.end()&&mp.find(ar[i].substr(k,j))!=mp.end())
ans+=mp[ar[i].substr(k,j)], M[ar[i].substr(k,j)]=1;
}
}
++mp[ar[i]];
}
cout<<ans;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |