Submission #310551

#TimeUsernameProblemLanguageResultExecution timeMemory
310551talant117408말 (IOI15_horses)C++17
Compilation error
0 ms0 KiB
#include "horses.h"
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <ll, ll> pii;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) (int)(v).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const ll mod = 1e9+7;
int n;
ll x[1007], y[1007];
pair <ll, ll> year[1007];

int init(int N, int X[], int Y[]) {
    n = N; 
    copy(X, X+n, x);
    copy(Y, Y+n, y);
    ll res = x[0];
    year[0] = {0, x[0]*y[0]};
    
    for(int i = 1; i < n; i++){
        year[i].first = year[i-1].first;
        year[i].second = year[i-1].second/y[i-1]*x[i]*y[i];
    }
    sort(year, year+n);
    
	return year[sz(year)-1].second;
}

int updateX(int pos, int val){
	return 0;
}

int updateY(int pos, int val){
	return 0;
}

/*
3
2 1 3
3 4 1
1
2 1 2

8
6
*/

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:17:24: error: request for member 'size' in 'year', which is of non-class type 'std::pair<long long int, long long int> [1007]'
   17 | #define sz(v) (int)(v).size()
      |                        ^~~~
horses.cpp:40:14: note: in expansion of macro 'sz'
   40 |  return year[sz(year)-1].second;
      |              ^~
horses.cpp:31:8: warning: unused variable 'res' [-Wunused-variable]
   31 |     ll res = x[0];
      |        ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:43:17: warning: unused parameter 'pos' [-Wunused-parameter]
   43 | int updateX(int pos, int val){
      |             ~~~~^~~
horses.cpp:43:26: warning: unused parameter 'val' [-Wunused-parameter]
   43 | int updateX(int pos, int val){
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:47:17: warning: unused parameter 'pos' [-Wunused-parameter]
   47 | int updateY(int pos, int val){
      |             ~~~~^~~
horses.cpp:47:26: warning: unused parameter 'val' [-Wunused-parameter]
   47 | int updateY(int pos, int val){
      |                      ~~~~^~~