답안 #152495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152495 2019-09-08T08:22:06 Z PedroBigMan Lozinke (COCI17_lozinke) C++14
25 / 100
296 ms 1524 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define INF ((ll) pow(2,63) -1)
#define si signed
ll insig;
#define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);}
void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
ll N, ans; vector<string> str; string s,t; bool eq; vector<string> sub;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>N; string cur;
    REP(i,0,N) {cin>>cur; str.pb(cur);}
    ans=0;
    sort(str.begin(),str.end());
    REP(i,0,N)
    {
        sub.clear();
        REP(l,0,str[i].size())
        {
            cur="";
            REP(r,l,str[i].size())
            {
                cur+=str[i][r]; sub.pb(cur);   
            }
        }
        REP(j,0,sub.size())
        {
            ans+=(ll) (upper_bound(str.begin(),str.end(),sub[j])-lower_bound(str.begin(),str.end(),sub[j]));
        }
    }
    cout<<ans-N<<endl;
    return 0;
}

Compilation message

lozinke.cpp: In function 'void Out(std::vector<long long int>)':
lozinke.cpp:10:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
lozinke.cpp:20:29:
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                             ~~~~~~~~~~~~
lozinke.cpp:20:25: note: in expansion of macro 'REP'
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                         ^~~
lozinke.cpp: In function 'int main()':
lozinke.cpp:10:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
lozinke.cpp:34:13:
         REP(l,0,str[i].size())
             ~~~~~~~~~~~~~~~~~    
lozinke.cpp:34:9: note: in expansion of macro 'REP'
         REP(l,0,str[i].size())
         ^~~
lozinke.cpp:10:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
lozinke.cpp:37:17:
             REP(r,l,str[i].size())
                 ~~~~~~~~~~~~~~~~~
lozinke.cpp:37:13: note: in expansion of macro 'REP'
             REP(r,l,str[i].size())
             ^~~
lozinke.cpp:10:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
lozinke.cpp:42:13:
         REP(j,0,sub.size())
             ~~~~~~~~~~~~~~       
lozinke.cpp:42:9: note: in expansion of macro 'REP'
         REP(j,0,sub.size())
         ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 3 ms 380 KB Output isn't correct
4 Incorrect 3 ms 376 KB Output isn't correct
5 Incorrect 10 ms 376 KB Output isn't correct
6 Incorrect 15 ms 528 KB Output isn't correct
7 Incorrect 19 ms 504 KB Output isn't correct
8 Correct 25 ms 504 KB Output is correct
9 Incorrect 84 ms 1016 KB Output isn't correct
10 Correct 141 ms 1012 KB Output is correct
11 Incorrect 138 ms 1016 KB Output isn't correct
12 Correct 290 ms 1016 KB Output is correct
13 Incorrect 239 ms 1524 KB Output isn't correct
14 Incorrect 218 ms 1524 KB Output isn't correct
15 Correct 296 ms 1524 KB Output is correct
16 Incorrect 248 ms 1524 KB Output isn't correct
17 Correct 253 ms 1520 KB Output is correct
18 Incorrect 164 ms 1520 KB Output isn't correct
19 Incorrect 238 ms 1520 KB Output isn't correct
20 Incorrect 146 ms 1524 KB Output isn't correct