Submission #145421

# Submission time Handle Problem Language Result Execution time Memory
145421 2019-08-19T20:03:55 Z JovanK26 Split the Attractions (IOI19_split) C++14
0 / 100
91 ms 10604 KB
#include "split.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q)
{
	vector<int> rez(n);
	vector<int> v[n];
	for(int i=0;i<p.size();i++)
    {
        v[p[i]].push_back(q[i]);
        v[q[i]].push_back(p[i]);
    }
	if(a==1)
    {
        int ind=-1;
        for(int i=0;i<n;i++)
        {
            rez[i]=0;
            if(v[i].size()>=b)
            {
                ind=i;
            }
        }
        if(ind!=-1)
        {
         rez[ind]=1;
        for(int i=0;i<v[ind].size();i++)
        {
            if(i==b)break;
            rez[v[ind][i]]=2;
        }
        for(int i=0;i<n;i++)
        {
            if(rez[i]==0)rez[i]=3;
        }
        }
        else
        {
            for(int i=0;i<n;i++)
            {
                rez[i]=0;
            }
        }
        return rez;
    }
    return rez;
}

Compilation message

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:8:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<p.size();i++)
              ~^~~~~~~~~
split.cpp:19:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(v[i].size()>=b)
                ~~~~~~~~~~~^~~
split.cpp:27:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<v[ind].size();i++)
                     ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB ok, correct split
2 Correct 2 ms 256 KB ok, correct split
3 Correct 2 ms 128 KB ok, correct split
4 Incorrect 2 ms 256 KB jury found a solution, contestant did not
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB ok, correct split
2 Correct 2 ms 376 KB ok, correct split
3 Correct 2 ms 256 KB ok, correct split
4 Correct 91 ms 10604 KB ok, correct split
5 Incorrect 79 ms 9080 KB jury found a solution, contestant did not
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB jury found a solution, contestant did not
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB jury found a solution, contestant did not
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB ok, correct split
2 Correct 2 ms 256 KB ok, correct split
3 Correct 2 ms 128 KB ok, correct split
4 Incorrect 2 ms 256 KB jury found a solution, contestant did not
5 Halted 0 ms 0 KB -