답안 #1046911

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1046911 2024-08-07T06:11:16 Z 12345678 마라톤 경주 (COCI14_utrka) C++17
80 / 80
93 ms 12112 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const ll mod=1e9+7, nx=1e5+5;

ll n, mul=31;
map<ll, pair<string, ll>> mp;
string s;

ll solve()
{
    ll sz=s.size(), res=0;
    for (int i=0; i<sz; i++) res=(res*mul)%mod, res+=s[i]-'a'+1;
    return res;
}

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s, mp[solve()].first=s, mp[solve()].second++;
    for (int i=1; i<n; i++) cin>>s, mp[solve()].second--;
    for (auto [x, y]:mp) if (y.second!=0) cout<<y.first;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 37 ms 6352 KB Output is correct
7 Correct 57 ms 9164 KB Output is correct
8 Correct 68 ms 11092 KB Output is correct
9 Correct 93 ms 12112 KB Output is correct
10 Correct 84 ms 12112 KB Output is correct