Submission #696105

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6961052023-02-05 13:31:15yogesh_saneHoliday (IOI14_holiday)C++17
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int const MAXN = 1e5;
long long subtask1(int n, int start, int d, int arrraction[]){
long long ans = 0;
for(int mask = 1; mask < (1<<n); mask++){
vector<int> cities;
for(int bit = 0; bit < n; bit++){
if(mask&(1<<bit)){
cities.push_back(bit);
}
}
int curr_city = start;
int tour_days = 0;
long long ans_curr = 0;
for(auto city : cities){
tour_days += abs(curr_city-city)+1;
ans_curr += arrraction[city];
curr_city = city;
}
if(tour_days <= d)
ans = max(ans, ans_curr);
reverse(cities.begin(), cities.end());
curr_city = start;
tour_days = 0;
ans_curr = 0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

holiday.cpp: In function 'long long int solve(std::vector<city>&, int)':
holiday.cpp:109:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<city>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  109 |     for(int i = 0; i < cities.size(); i++)
      |                    ~~^~~~~~~~~~~~~~~
holiday.cpp:114:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<city>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  114 |     for(int r = 0; r < cities.size(); r++){
      |                    ~~^~~~~~~~~~~~~~~
holiday.cpp: In function 'long long int subtask3(int, int, int, int*)':
holiday.cpp:142:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<city>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  142 |         for(int j = 0; j < cts.size(); j++)
      |                        ~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccBdELOO.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccBOwo9L.o:holiday.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status