Submission #755618

#TimeUsernameProblemLanguageResultExecution timeMemory
755618KemalKCyberland (APIO23_cyberland)C++17
0 / 100
22 ms2120 KiB
#include "cyberland.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;


double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) {
	int ans[4];
	if (N==2) 
	{
		ans[0]=c[0];
	}
	
  	if (N==3) 
	{
	  	for (int i=0; i<M; i++) 
		{
		  	if (x[i]==0  && y[i]==H) 
			{
		  		ans[0]=c[i];
			}
			else if (x[i]==0) 
			{
				ans[1]==c[0]+c[1];
				if (arr[1]==0) 
				{
					ans[1]=c[1];
				}
				else if (arr[1]==2 && i==1) 
				{
					ans[1]==c[1]/2+c[0];
				}
				else if (arr[1]==2 && i==0) 
				{
					ans[1]==c[0]/2+c[1];
				}
			}
			if (y[i]==0  && x[i]==H) 
			{
		  		ans[2]=c[i];
			}
			else if (y[i]==0) 
			{
				ans[3]==c[0]+c[1];
				if (arr[1]==0) 
				{
					ans[3]=c[1];
				}
				else if (arr[1]==2 && i==0) 
				{
					ans[3]==c[0]/2+c[1];
				}
				else if (arr[1]==2 && i==1) 
				{
					ans[1]==c[1]/2+c[0];
				}
			}
		}
	}
	for (int i=0; i<3; i++) 
	{
		for(int j=i+1; j<=3; j++) 
		{
			if (ans[i]>ans[j]) 
			{
				swap(ans[i],ans[j]);
			}
		}
	}
	cout<<ans[3];
    return 0;
}
			

Compilation message (stderr)

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:24:11: warning: value computed is not used [-Wunused-value]
   24 |     ans[1]==c[0]+c[1];
cyberland.cpp:31:12: warning: value computed is not used [-Wunused-value]
   31 |      ans[1]==c[1]/2+c[0];
cyberland.cpp:35:12: warning: value computed is not used [-Wunused-value]
   35 |      ans[1]==c[0]/2+c[1];
cyberland.cpp:44:11: warning: value computed is not used [-Wunused-value]
   44 |     ans[3]==c[0]+c[1];
cyberland.cpp:51:12: warning: value computed is not used [-Wunused-value]
   51 |      ans[3]==c[0]/2+c[1];
cyberland.cpp:55:12: warning: value computed is not used [-Wunused-value]
   55 |      ans[1]==c[1]/2+c[0];
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...