Submission #482916

#TimeUsernameProblemLanguageResultExecution timeMemory
482916MohamedAliSaidane로봇 (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; typedef pair<int,int> pii; typedef vector<int> vi; typedef long long ll; typedef pair<ll,ll> pll; typedef tuple<int,int,int> ti; typedef unsigned long long ull; typedef long double ld; typedef vector<ll> vll; typedef pair<ld,ld> pld; #define pb push_back #define popb pop_back() #define pf push_front #define popf pop_front #define ff first #define ss second #define MOD (ll)(1000000007) #define INF (ll) (1e18) #define all(v) (v).begin(),(v).end() const int nx[8] = {0, 0, 1, -1,1,1,-1,-1}, ny[8] = {1, -1, 0, 0,1,-1,1,-1}; //East, West, South, North+ ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} ll lcm(ll a, ll b){return (a / gcd(a, b)) * b;} ////////////******SOLUTION******\\\\\\\\\\\ int putaway(int A, int B, int T, ll X[], ll Y[], ll W[], ll S[]) { ll wmax = 0; ll smax = 0; for(int i = 0; i < A; i ++) wmax = max(wmax,X[i]); for(int i = 0; i < B; i ++) smax = max(smax,Y[i]); for(int i = 0; i < T; i ++) if(W[i] >= wmax && S[i] >= smax) return -1; // subtask 1 if(T == 2 && A+B == 2) { if(A == 2) { if(min(X[0],X[1]) > min(W[0],W[1]) && max(X[0],X[1]) > max(W[0],W[1])) return 1; } else if(B == 2) { if(min(Y[0],Y[1]) > min(S[0],S[1]) && max(Y[0],Y[1]) > max(S[0],S[1])) return 1; } else { if((X[0] > W[0] && Y[0] > S[1]) || (X[0] > W[1] && Y[0] > S[0])) return 1; } return 2; } if(B == 0) // subtask 2 { sort(W,W+T); sort(X,X+A); int j = 0; int ans = 1; for(int i= 0; i<T; i ++) { if(j >= A) { ans ++; j = 0; } int debut = j; int fin = A -1; j = A; while(debut <= fin) { int mid = (debut+fin)/2; if(X[mid] > W[i]) { j = mid; fin = mid - 1; } else debut = mid + 1; } j ++; } return ans; } return 1; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int A, B, T; cin >> A >> B >> T; ll X[A], Y[B], W[T], S[T]; for(int i = 0; i < A; i ++) { ll x; cin >> x; X[i]=x; } for(int i = 0; i< B; i ++) { ll y; cin >> y; Y[i]=y; } for(int i = 0; i < T; i ++) { ll w, s; cin >> w >> s; W[i] = w; S[i] = s; } cout << putaway(A,B,T,X,Y,W,S) << '\n'; } /* 5 0 6 2 3 4 5 6 1 80 2 80 3 80 4 80 1 80 5 80 */

Compilation message (stderr)

robots.cpp:25:1: warning: multi-line comment [-Wcomment]
   25 | ////////////******SOLUTION******\\\\\\\\\\\
      | ^
/usr/bin/ld: /tmp/ccVFG8Iw.o: in function `main':
robots.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccZd1JLy.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccZd1JLy.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status