답안 #874009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
874009 2023-11-16T07:41:57 Z teacup 친구 (IOI14_friend) C++14
0 / 100
1 ms 604 KB
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
int findSample(int n, int confidence[], int host[], int protocol[]){
    int t1=confidence[0], t2=0;
    int S[]={}; S[0]=1;
    for (int i=1; i<n; i++){
		if (protocol[i]==0){
			S[i]=3-S[host[i]];
		}else if (protocol[i]==1){
			S[i]=S[host[i]];
		}else{
			//clown
		}
		
		if (S[i]==1){
			t1+=confidence[i];
		}else if (S[i]==2){
			t2+=confidence[i];
		}
	}
	return max(t1,t2);
}

Compilation message

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:11:18: warning: array subscript <unknown> is outside array bounds of 'int [0]' [-Warray-bounds]
   11 |    S[i]=S[host[i]];
      |         ~~~~~~~~~^
friend.cpp:6:9: note: while referencing 'S'
    6 |     int S[]={}; S[0]=1;
      |         ^
friend.cpp:11:7: warning: array subscript i is outside array bounds of 'int [0]' [-Warray-bounds]
   11 |    S[i]=S[host[i]];
      |    ~~~^
friend.cpp:6:9: note: while referencing 'S'
    6 |     int S[]={}; S[0]=1;
      |         ^
friend.cpp:9:20: warning: array subscript <unknown> is outside array bounds of 'int [0]' [-Warray-bounds]
    9 |    S[i]=3-S[host[i]];
      |           ~~~~~~~~~^
friend.cpp:6:9: note: while referencing 'S'
    6 |     int S[]={}; S[0]=1;
      |         ^
friend.cpp:9:7: warning: array subscript i is outside array bounds of 'int [0]' [-Warray-bounds]
    9 |    S[i]=3-S[host[i]];
      |    ~~~^
friend.cpp:6:9: note: while referencing 'S'
    6 |     int S[]={}; S[0]=1;
      |         ^
friend.cpp:16:10: warning: array subscript i is outside array bounds of 'int [0]' [-Warray-bounds]
   16 |   if (S[i]==1){
      |       ~~~^
friend.cpp:6:9: note: while referencing 'S'
    6 |     int S[]={}; S[0]=1;
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -