Submission #354740

#TimeUsernameProblemLanguageResultExecution timeMemory
354740kylych03Roller Coaster Railroad (IOI16_railroad)C++14
Compilation error
0 ms0 KiB
#include "railroad.h"
#include <bits/stdc++.h>
#include "grader.cpp"
#define ll long long
using namespace std;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
    int n = (int) s.size();
    
    map <ll, ll> mp;
	map <ll, ll> ::iterator it;
	
	for(int i = 0 ; i < n;i++){
    	mp[s[i]]--;
		mp[t[i]]++;
    }
    mp[0]++;
    ll cnt = 0, res=0, last = 0;
    
    for( it = mp.begin() ; it!=mp.end() ; it++){
    		
		//cout << cnt<< " - " <<it->first<<" - " <<it->second<<endl;
    	if(cnt < 0){
    	//	cout << cnt <<" ok " <<it->first <<" - " << last << endl; 	
			res+= ( cnt * 1ll* (last - it->first) );
		}
		last = it->first;
		cnt += it->second;
    }
    
    return res;
}

Compilation message (stderr)

/tmp/ccwNNS0I.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccdG9Ev7.o:railroad.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status