답안 #157568

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
157568 2019-10-12T13:04:26 Z ToniB Elder (COCI19_elder) C++14
20 / 50
2 ms 376 KB
#include <iostream>

using namespace std;

int main(){
	
	int N, v[90];
	int broj = 1;
	char sol, X, Y;
	cin >> sol;
	cin >> N;
	
	
	for(int i = 0; i < N; ++i){
		cin >> X >> Y;
		
		if(sol == Y){
			sol = X;
			v[(int)X] = 1;
			
			}
			
		}
		
	for(int i = 1; i < 91; ++i){
		broj += v[i];
		
		
	}
	cout << sol << endl;
	cout << broj;
	
	
	return 0;
	
}

Compilation message

elder.cpp: In function 'int main()':
elder.cpp:26:14: warning: iteration 89 invokes undefined behavior [-Waggressive-loop-optimizations]
   broj += v[i];
           ~~~^
elder.cpp:25:19: note: within this loop
  for(int i = 1; i < 91; ++i){
                 ~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 376 KB Output is partially correct
2 Partially correct 2 ms 256 KB Output is partially correct
3 Partially correct 2 ms 256 KB Output is partially correct
4 Partially correct 2 ms 256 KB Output is partially correct
5 Partially correct 2 ms 256 KB Output is partially correct
6 Partially correct 2 ms 256 KB Output is partially correct
7 Partially correct 2 ms 256 KB Output is partially correct
8 Partially correct 2 ms 256 KB Output is partially correct
9 Partially correct 2 ms 256 KB Output is partially correct
10 Partially correct 2 ms 256 KB Output is partially correct