Submission #1079074

# Submission time Handle Problem Language Result Execution time Memory
1079074 2024-08-28T10:24:40 Z anton Tiles (BOI24_tiles) C++17
0 / 100
107 ms 15524 KB
#include<bits/stdc++.h>
    
using namespace std;
#define int long long
#define pt complex<int>
#define pii pair<int, int>
int N, M;
vector<pt> points; 


int cross(pt a, pt b){
    return (a * conj(b)).imag();
}

struct Edge{
    pt a, b;
    pt d(){
        return b-a;
    }
};
signed main(){
    cin>>N>>M;
    
    for(int i = 0; i<N; i++){
        int a, b;
        cin>>a>>b;
        points.push_back({a, b});
    }
    
    vector<Edge> edges;
    pt prev_pt= points.back();
    for(int i = 0; i<N; i++){
        pt edge = points[i]-prev_pt;
        if(edges.size()>0 && cross(edges.back().d(), edge) == 0){
            edges.back().b=  points[i];
        }
        else{
            edges.push_back(Edge{prev_pt, points[i]});
        }
        prev_pt=  points[i];
    }

    while(cross(edges.back().d(), edges[0].d()) == 0){
        edges[0].a = edges.back().a;
        edges.pop_back();
    }

    int k = M;

    for(auto edge: edges){
        if(edge.d().imag() == 0){
            if((edge.d().real()%2) ==1){
                k = min(k, max(edge.a.real()-edge.a.real()%2, edge.b.real()-edge.b.real()%2));
            }
        }
    }

    cout<<k<<endl;
}
# 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 1 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 21 ms 3728 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 62 ms 8044 KB Output is correct
3 Correct 51 ms 7952 KB Output is correct
4 Incorrect 67 ms 13212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 107 ms 15524 KB Output isn't correct
2 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 -