제출 #210205

#제출 시각아이디문제언어결과실행 시간메모리
210205mohamedsobhi777Friend (IOI14_friend)C++14
0 / 100
6 ms504 KiB
#include<bits/stdc++.h>
#include<friend.h>

using namespace std ; 

const int N = 1e5 + 5 ; 

int findSample(int n , int confidence[] , int host[] , int protocol[]){
    int sol[n+1];
    for(int i = 0 ; i < n; i++)
        sol[i] = confidence[i] ; 
    int ret = 0 ; 
    for(int i  = i-1 ; i>=0 ; i--){
        int p = protocol[i] ; 
        if(!p){
            ret+=sol[i] ; 
            sol[host[i]] = max(0 , sol[host[i]] - sol[i]) ; 
        }
        else if(p==1){
            sol[host[i]] +=sol[i] ; 
        }
        else{
            sol[host[i]] = max(sol[host[i]]  ,sol[i]) ; 
        }
    }
    return sol[0] + ret ; 
}

컴파일 시 표준 에러 (stderr) 메시지

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:13:13: warning: 'i' is used uninitialized in this function [-Wuninitialized]
     for(int i  = i-1 ; i>=0 ; i--){
             ^
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…