# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1031347 |
2024-07-22T18:19:27 Z |
Abito |
Tiles (BOI24_tiles) |
C++17 |
|
28 ms |
5460 KB |
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
//#define int long long
#define ll long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=2e5+5;
int n,x[N],y[N],m,inp;
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>inp>>m;
for (int i=1;i<=inp;i++){
int xx,yy;
cin>>xx>>yy;
if (i<=2){
x[++n]=xx;
y[n]=yy;
continue;
}
if (xx==x[n] && xx==x[n-1]){
x[n]=xx;
y[n]=yy;
continue;
}
if (yy==y[n] && yy==y[n-1]){
x[n]=xx;
y[n]=yy;
continue;
}
x[++n]=xx;
y[n]=yy;
}
if (n==2){
cout<<m<<endl;
return 0;
}
if (n==4){
sort(x+1,x+1+n);
sort(y+1,y+1+n);
if (y[1]==y[n]){
cout<<m<<endl;
return 0;
}
if ((y[n]-y[1])&1){
cout<<x[1]<<endl;
return 0;
}
cout<<x[n]-bool((x[n]-x[1])&1)<<endl;
return 0;
}
if (n==6){
pair<int,int> mn={INT_MAX,INT_MAX};
vector<pair<int,int>> v;
for (int i=1;i<=n;i++) v.pb({x[i],y[i]}),mn=min(mn,v.back());
while (v[0]!=mn){
v.pb(v[0]);
v.erase(v.begin());
}
if (v[1].F!=v[0].F) reverse(v.begin()+1,v.end());
//for (auto u:v) cout<<u.F<<' '<<u.S<<endl;
int ans=v[0].F;
if ((v[1].S-v[0].S)%2==0){
if ((v[2].F-v[0].F)&1){
cout<<v[2].F-1<<endl;
return 0;
}
ans=v[2].F;
}
else{
cout<<ans<<endl;
return 0;
}
if (v.back().S-v[0].S%2==0){
ans=v.back().F-bool((v.back().F-v[0].F)&1);
}
cout<<ans<<endl;
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
1 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 |
344 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 |
1 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 |
0 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 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 |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
14 ms |
3164 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
5460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
1 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 |
0 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |