답안 #962957

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
962957 2024-04-14T10:13:14 Z vivkostov 꿈 (IOI13_dreaming) C++14
0 / 100
29 ms 10580 KB
#include<bits/stdc++.h>
#include "dreaming.h"
using namespace std;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
struct cell
{
    int to,cost;
};
int n,m,l,A[100005],B[100005],C[100005],used[100005],sum[100005],le[10];
vector<cell>v[100005];
void find_sum(int beg,int lead,int num)
{
    used[beg]=1;
    int w;
    if(v[beg].size()==1)le[num]=beg;
    for(int i=0;i<(int)(v[beg].size());i++)
    {
        w=v[beg][i].to;
        if(!used[w])
        {
            find_sum(w,lead,num);
            sum[lead]+=v[beg][i].cost;
        }
    }
}
int travelTime(int n,int m,int l,int A[],int B[],int C[])
//void read()
{
    //cin>>n>>m>>l;
    cell h;
    for(int i=1;i<=m;i++)
    {
        //cin>>A[i]>>B[i]>>C[i];
        A[i]++;
        B[i]++;
        h.to=A[i];
        h.cost=C[i];
        v[B[i]].push_back(h);
        h.to=B[i];
        v[A[i]].push_back(h);
    }
    int br=0;
    for(int i=1;i<=n;i++)
    {
        if(!used[i])
        {
            br++;
            find_sum(i,i,br);
        }
    }
    memset(used,0,sizeof(used));
    int aa=0;
    for(int i=1;i<=n;i++)
    {
        aa=max(aa,sum[i]);
    }
    //cout<<aa<<endl;
    return aa;
}
/*int main()
{
    speed();
    read();
    return 0;
}
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 10580 KB Output is correct
2 Correct 27 ms 10328 KB Output is correct
3 Correct 23 ms 9580 KB Output is correct
4 Correct 5 ms 5464 KB Output is correct
5 Correct 4 ms 4956 KB Output is correct
6 Incorrect 8 ms 5720 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 10580 KB Output is correct
2 Correct 27 ms 10328 KB Output is correct
3 Correct 23 ms 9580 KB Output is correct
4 Correct 5 ms 5464 KB Output is correct
5 Correct 4 ms 4956 KB Output is correct
6 Incorrect 8 ms 5720 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 6488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 10580 KB Output is correct
2 Correct 27 ms 10328 KB Output is correct
3 Correct 23 ms 9580 KB Output is correct
4 Correct 5 ms 5464 KB Output is correct
5 Correct 4 ms 4956 KB Output is correct
6 Incorrect 8 ms 5720 KB Output isn't correct
7 Halted 0 ms 0 KB -