제출 #422073

#제출 시각아이디문제언어결과실행 시간메모리
422073Peti친구 (IOI14_friend)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h>
#include "friend.h"

using namespace std;

// Find out best sample
int findSample(int n,int confidence[], int host[], int protocol[]){
    vector<pair<int, int>> v(n, make_pair(0, 0));
    for(int i = 0; i < n; i++)
        v[i].first = confidence[i];
    for(int i = n-1; i > 0; i--){
        if(protocol[i] == 0){
            v[host[i]].first += v[i].second;
            v[host[i]].second += v[i].first;
            v[host[i]].second = max(v[host[i]].second, v[host[i]].first - confidence[host[i]]);
        } else if(protocol[i] == 1){
            v[host[i]].first += v[i].first;
            v[host[i]].second += v[i].second;
            //v[host[i]].second = max(v[host[i]].second, v[host[i]].first - confidence[host[i]]);
        } else{
            v[host[i]].first = max(v[host[i]].first + v[i].second, v[host[i]].first + v[i].first - confidence[host[i]]);
            v[host[i]].second += v[i].second;
            //v[host[i]].second = max(v[host[i]].second, v[host[i]].first - confidence[host[i]]);
        }
    }

    for(int i = 0; i < n; i++)
        cout<<v[i].first<<" "<<v[i].second<<"\n";

	return max(v[0].first, v[0].second);
}

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:27:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   27 |     for(int i = 0; i < n; i++)
      |     ^~~
friend.cpp:30:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   30 |  return max(v[0].first, v[0].second);
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...