Created
January 17, 2015 14:51
-
-
Save StarOrpheus/8b74a0cc3330fff54568 to your computer and use it in GitHub Desktop.
lel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" /> | |
<component name="ProjectRootManager" version="2" /> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/test.iml" filepath="$PROJECT_DIR$/.idea/test.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="CPP_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="VcsDirectoryMappings"> | |
<mapping directory="" vcs="" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 2.8.4) | |
project(test) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
set(SOURCE_FILES main.cpp) | |
add_executable(test ${SOURCE_FILES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
#include <cstdio> | |
#include <string> | |
#include <cstring> | |
#include <vector> | |
using namespace std; | |
#define MAX(x, y) ((x > y) ? (x) : (y)) | |
#define MIN(x, y) ((x < y) ? (x) : (y)) | |
int main(){ | |
//freopen("seabattle.in", "r", stdin); freopen("seabattle.out", "w", stdout); | |
int n, m; | |
int k, x, y; | |
cin >> n >> m; | |
cin >> x >> y; | |
cin >> k; | |
int rxu = MAX(x - 1, 0), rxd = MAX(n - x, 0), ryl = MAX(y - 1, 0), ryr = MAX(m - y, 0); | |
cout << rxu << " " << rxd << " " << ryl << " " << ryr << endl; | |
if(!rxu) | |
{ | |
if(!ryl && !ryr) | |
{ | |
cout << (k-1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
if(!ryl && !rxd) | |
{ | |
cout << (k-1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
if(!ryr && !rxd) | |
{ | |
cout << (k-1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
cout << (k+1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
if(!ryr) | |
{ | |
if ((!rxu && !rxd) || (!ryl && !rxu) || (!ryl && !rxd)) | |
{ | |
cout << (k - 1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
cout << k+1 << endl; | |
exit(EXIT_SUCCESS); | |
} | |
if(!rxd) | |
{ | |
if((!rxu && !ryl) || (!rxu && !ryr) || (!ryl && !ryr)) | |
{ | |
cout << (k-1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
cout << k+1 << endl; | |
} | |
if(!ryl) | |
{ | |
if((!rxu && !rxd) || (!rxu && !ryr) || (!rxd && !ryr)) | |
{ | |
cout << (k-1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
cout << (k+1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
if((rxd <= k/2 || rxu <= k/2) && (ryl <= k/2 || ryr <= k/2)) | |
{ | |
cout << (k+1) << endl; | |
exit(EXIT_SUCCESS); | |
} | |
cout << (k+2) << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment