Submission #730295

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7302952023-04-25 15:18:57ogibogi2004Rail (IOI14_rail)C++14
100 / 100
90 ms772 KiB
#include "rail.h"
#include<bits/stdc++.h>
using namespace std;
void findLocation(int N, int first, int location[], int stype[])
{
memset(stype,0,sizeof(stype));
memset(location,0,sizeof(location));
location[0]=first;
stype[0]=1;
map<int,int> mtype;
mtype[location[0]]=1;
vector<pair<int,int> >distances;
vector<int>dist0(N);
vector<int>dist1(N);
for(int i=1;i<N;i++)
{
distances.push_back({getDistance(0, i),i});
dist0[i]=distances.back().first;
}
sort(distances.begin(),distances.end());
location[distances[0].second]=location[0]+distances[0].first;
stype[distances[0].second]=2;
mtype[location[distances[0].second]]=2;
set<int>cs;
set<int>ds;
int minc=0,maxd=distances[0].second,sec=maxd;
cs.insert(location[0]);
ds.insert(location[distances[0].second]);
for(int i=1;i<N;i++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:7:27: warning: 'sizeof' on array function parameter 'stype' will return size of 'int*' [-Wsizeof-array-argument]
    7 |     memset(stype,0,sizeof(stype));
      |                          ~^~~~~~
rail.cpp:5:57: note: declared here
    5 | void findLocation(int N, int first, int location[], int stype[])
      |                                                     ~~~~^~~~~~~
rail.cpp:7:20: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    7 |     memset(stype,0,sizeof(stype));
      |                    ^~~~~~~~~~~~~
rail.cpp:8:30: warning: 'sizeof' on array function parameter 'location' will return size of 'int*' [-Wsizeof-array-argument]
    8 |     memset(location,0,sizeof(location));
      |                             ~^~~~~~~~~
rail.cpp:5:41: note: declared here
    5 | void findLocation(int N, int first, int location[], int stype[])
      |                                     ~~~~^~~~~~~~~~
rail.cpp:8:23: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    8 |     memset(location,0,sizeof(location));
      |                       ^~~~~~~~~~~~~~~~
rail.cpp:35:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for(int i=1;i<distances.size();i++)
      |                 ~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...