Submission #1005059

# Submission time Handle Problem Language Result Execution time Memory
1005059 2024-06-22T06:48:43 Z salmon Tiles (BOI24_tiles) C++14
4 / 100
58 ms 13904 KB
#include <bits/stdc++.h>
using namespace std;

int N,M;
int fx,fy;
int px,py;
int x,y;
map<int,set<pair<int,int>>> mep;
int fum = 1.1e9;

int main(){
	
	scanf(" %d",&N);
	scanf(" %d",&M);
	
	scanf(" %d",&fx);
	scanf(" %d",&fy);
	
	px = fx;
	py = fy;
	
	for(int i = 0; i < N - 1; i++){
		scanf(" %d",&x);
		scanf(" %d",&y);
		
		if(px == x){
			mep.insert({x,{{min(y,py),max(y,py)}} });
			if(x % 2 == 1){
				fum = x;
			}
		}
		px = x;
		py = y;
	}
	
	if(px == fx){
		mep.insert({px,{{min(fy,py),max(fy,py)}} });
		if(px % 2 == 1){
			fum = px;
		}
	}
	
	mep.erase(mep.rbegin() -> first);
	
	int num = 0;
	bool die = false;
	
	for(pair<int,set<pair<int,int>>> ii : mep){
		set<pair<int,int>> sat = ii.second;
		num = max(num,ii.first - 2);
		if(ii.first > fum){
			num = min(num,fum-1);
			break;
		}
		bool die = false;
		
		for(pair<int,int> ii : sat){
			if((ii.second - ii.first)%2 != 0){
				die = true;
				break;
			}
		}
		
		if(die) break;
		

		if(ii.first == mep.rbegin() -> first ){
			num = min(fum - 1,M);
			break;
		}
		break;
	}
	
	printf("%d\n",num);
	
	
	
	
}
/*
4 3
0 4
3 4
3 0
0 0
 */

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:46:7: warning: unused variable 'die' [-Wunused-variable]
   46 |  bool die = false;
      |       ^~~
Main.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf(" %d",&N);
      |  ~~~~~^~~~~~~~~~
Main.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  scanf(" %d",&M);
      |  ~~~~~^~~~~~~~~~
Main.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf(" %d",&fx);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  scanf(" %d",&fy);
      |  ~~~~~^~~~~~~~~~~
Main.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |   scanf(" %d",&x);
      |   ~~~~~^~~~~~~~~~
Main.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |   scanf(" %d",&y);
      |   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 30 ms 7356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 13904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -