답안 #309075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
309075 2020-10-02T17:21:32 Z Doda 마라톤 경주 (COCI14_utrka) C++17
80 / 80
345 ms 19036 KB
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

#define pb push_back
#define fr(n) for (int i = 0; i<n;i++)

typedef long long ll;
using namespace std;

ll pot (ll q, ll w){
	ll qw = 1;
	for (ll i = 0; i<w; i++)
		qw*= q;
	return qw;
}

ll n;
map <string, int> mapa;
vector<string> popis;
string rj;

int main () {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);

cin >> n;

fr(n*2-1){
    string s;
    cin >> s;
    mapa[s]+=1;
    popis.pb(s);
}

sort (popis.begin(), popis.end());
popis.erase(unique(popis.begin(),popis.end() ), popis.end() );

fr(popis.size()){
    if (mapa[popis[i]] % 2 != 0){
        rj = popis[i];
        cout << rj;
        return 0;
    }
}

return 0;
}

Compilation message

utrka.cpp: In function 'int main()':
utrka.cpp:10:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define fr(n) for (int i = 0; i<n;i++)
      |                               ~^~~~~~~
   11 | 
      |                                 
   12 | typedef long long ll;
      | ~~~~~~~~~~~~~~~~~~~~~           
   13 | using namespace std;
      | ~~~~~~~~~~~~~~~~~~~~            
   14 | 
      |                                 
   15 | ll pot (ll q, ll w){
      | ~~~~~~~~~~~~~~~~~~~~            
   16 |  ll qw = 1;
      |  ~~~~~~~~~~                     
   17 |  for (ll i = 0; i<w; i++)
      |  ~~~~~~~~~~~~~~~~~~~~~~~~       
   18 |   qw*= q;
      |   ~~~~~~~                       
   19 |  return qw;
      |  ~~~~~~~~~~                     
   20 | }
      | ~                               
   21 | 
      |                                 
   22 | ll n;
      | ~~~~~                           
   23 | map <string, int> mapa;
      | ~~~~~~~~~~~~~~~~~~~~~~~         
   24 | vector<string> popis;
      | ~~~~~~~~~~~~~~~~~~~~~           
   25 | string rj;
      | ~~~~~~~~~~                      
   26 | 
      |                                 
   27 | int main () {
      | ~~~~~~~~~~~~~                   
   28 | ios::sync_with_stdio(0);
      | ~~~~~~~~~~~~~~~~~~~~~~~~        
   29 | cin.tie(0); cout.tie(0);
      | ~~~~~~~~~~~~~~~~~~~~~~~~        
   30 | 
      |                                 
   31 | cin >> n;
      | ~~~~~~~~~                       
   32 | 
      |                                 
   33 | fr(n*2-1){
      | ~~~~~~~~~~                      
   34 |     string s;
      |     ~~~~~~~~~                   
   35 |     cin >> s;
      |     ~~~~~~~~~                   
   36 |     mapa[s]+=1;
      |     ~~~~~~~~~~~                 
   37 |     popis.pb(s);
      |     ~~~~~~~~~~~~                
   38 | }
      | ~                               
   39 | 
      |                                 
   40 | sort (popis.begin(), popis.end());
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   41 | popis.erase(unique(popis.begin(),popis.end() ), popis.end() );
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 | 
      |                                 
   43 | fr(popis.size()){
      | ~~~~~~~~~~~~~~~                 
utrka.cpp:43:1: note: in expansion of macro 'fr'
   43 | fr(popis.size()){
      | ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 142 ms 9828 KB Output is correct
7 Correct 246 ms 17116 KB Output is correct
8 Correct 318 ms 18396 KB Output is correct
9 Correct 345 ms 19036 KB Output is correct
10 Correct 330 ms 19036 KB Output is correct