답안 #313674

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
313674 2020-10-16T14:48:47 Z neki Elder (COCI19_elder) C++14
50 / 50
1 ms 256 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 2600
#define pa pair<ll, ll>
#define ld long double 
ll a[mn], b[mn];
map<char, ll > neki;
int main(){
    char cur;sc(" %c ", &cur);
    neki[cur]=1;
    ll n;cin >> n;
    loop(i, 0, n){
        char a, b;sc(" %c %c ", &a, &b);
        if(b==cur) cur=a, neki[a]=1;
    }
    cout << cur<<endl;
    cout << neki.size()<<endl;
}

Compilation message

elder.cpp: In function 'int main()':
elder.cpp:25:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   25 |     char cur;sc(" %c ", &cur);
      |                ^
elder.cpp:29:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   29 |         char a, b;sc(" %c %c ", &a, &b);
      |                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct