Submission #1191065

#TimeUsernameProblemLanguageResultExecution timeMemory
1191065Ak_16카니발 티켓 (IOI20_tickets)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include "tickets.h"
#include <algorithm>
#include <vector>
using namespace std;
#define int long long

int n,m;
vector<vector<int>> s,y;
int l[2000];
int r[2000];
int now[2000];
int up[2000];
int tot;

bool cmp(int n1, int n2){
  return y[n1][l[n1]] + y[n1][r[n1]] < y[n2][l[n2]] + y[n2][r[n2]];
}


int find_maximum(int k, vector<vector<int>> x){
  n = x.size();
  m = x[0].size();
  tot=0;
  
  y = x;
  s = x;
  
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      s[i][j]=-1;
    }
  }
  
  for(int i=0; i<n; i++){
    l[i]=0;
    r[i]=m-1;
  }
  
  for(int ro=0; ro<k; ro++){
    
    for(int i=0; i<n; i++){
      up[i]=0;
    }
    
    for(int i=0; i<n; i++){
      now[i]=i;
    }
    
    sort(now, now+n, cmp);
    
    for(int i=0; i<n/2; i++){
      tot -= y[now[i]][l[now[i]]];
      s[now[i]][l[now[i]]]=ro;
      l[now[i]]++;
    }
    
    for(int i=n/2; i<n; i++){
      tot += y[now[i]][r[now[i]]];
      s[now[i]][r[now[i]]]=ro;
      r[now[i]]--;
    }
    
  }
  
  allocate_tickets(s);
  
  return tot;
  
}

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(long long int, std::vector<std::vector<long long int> >)':
tickets.cpp:66:20: error: could not convert 's' from 'vector<vector<long long int>>' to 'vector<vector<int>>'
   66 |   allocate_tickets(s);
      |                    ^
      |                    |
      |                    vector<vector<long long int>>