답안 #312459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
312459 2020-10-13T11:22:48 Z neki Lozinke (COCI17_lozinke) C++14
100 / 100
515 ms 17016 KB
#include <bits/stdc++.h>
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 26000
#define pa pair<ll, ll>
#define ld long double 
map<string, ll> dp;
string arr[mn];
int main(){
    ll n, ans=0;cin >> n;
    loop(i, 0, n){
        string a;cin >> a;
        arr[i]=a;
        map<string, ll>temp;
        loop(x, 0, a.length()+1) loop(y, x+1, a.length()+1) temp[a.substr(x, y-x)]=1;
        fore(v, temp) dp[v.fi]++;
    }
    loop(i, 0, n) ans+=dp[arr[i]]-1;
    cout << ans<<endl;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:2:42: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define loop(i, a, b) for(long long i=a;i<b;i++)
......
   30 |         loop(x, 0, a.length()+1) loop(y, x+1, a.length()+1) temp[a.substr(x, y-x)]=1;
      |              ~~~~~~~~~~~~~~~~~~           
lozinke.cpp:30:9: note: in expansion of macro 'loop'
   30 |         loop(x, 0, a.length()+1) loop(y, x+1, a.length()+1) temp[a.substr(x, y-x)]=1;
      |         ^~~~
lozinke.cpp:2:42: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define loop(i, a, b) for(long long i=a;i<b;i++)
......
   30 |         loop(x, 0, a.length()+1) loop(y, x+1, a.length()+1) temp[a.substr(x, y-x)]=1;
      |                                       ~~~~~~~~~~~~~~~~~~~~
lozinke.cpp:30:34: note: in expansion of macro 'loop'
   30 |         loop(x, 0, a.length()+1) loop(y, x+1, a.length()+1) temp[a.substr(x, y-x)]=1;
      |                                  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1152 KB Output is correct
2 Correct 1 ms 1152 KB Output is correct
3 Correct 2 ms 1152 KB Output is correct
4 Correct 2 ms 1152 KB Output is correct
5 Correct 11 ms 1536 KB Output is correct
6 Correct 19 ms 1536 KB Output is correct
7 Correct 25 ms 2176 KB Output is correct
8 Correct 38 ms 3064 KB Output is correct
9 Correct 104 ms 2936 KB Output is correct
10 Correct 216 ms 8056 KB Output is correct
11 Correct 173 ms 4728 KB Output is correct
12 Correct 485 ms 17016 KB Output is correct
13 Correct 309 ms 3064 KB Output is correct
14 Correct 341 ms 15224 KB Output is correct
15 Correct 515 ms 16760 KB Output is correct
16 Correct 319 ms 1656 KB Output is correct
17 Correct 88 ms 1400 KB Output is correct
18 Correct 64 ms 1280 KB Output is correct
19 Correct 343 ms 8824 KB Output is correct
20 Correct 161 ms 1400 KB Output is correct