Submission #1034017

# Submission time Handle Problem Language Result Execution time Memory
1034017 2024-07-25T08:50:11 Z 김은성(#10970) Tiles (BOI24_tiles) C++17
0 / 100
30 ms 5836 KB
#define x first
#define y second
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, xm, i, j, x, y;
    scanf("%d %d", &n, &xm);
    vector<pair<int, int> > p;
    p.push_back(make_pair(0, 0));
    for(i=1; i<n; i++){
        scanf("%d %d", &x, &y);
        if(p.size() >= 2 && ((p[p.size()-2].x == p[p.size()-1].x && p.back().x==x) ||
              (p[p.size()-2].y == p[p.size()-1].y && p.back().y==y)))
            p.pop_back();
        p.push_back(make_pair(x, y));
    }
    int opt = 0;
    for(i=0; i<p.size(); i++){
        //printf("x=%d y=%d\n", p[i].x, p[i].y);
        if(p[i].x%2==0 && p[i].y%2==0)
            opt= p[i].x;
        else
            break;
    }
    printf("%d\n", opt);
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:18:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(i=0; i<p.size(); i++){
      |              ~^~~~~~~~~
Main.cpp:6:19: warning: unused variable 'j' [-Wunused-variable]
    6 |     int n, xm, i, j, x, y;
      |                   ^
Main.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d", &n, &xm);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
Main.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d %d", &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 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 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 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 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 5836 KB Output is correct
2 Correct 16 ms 3280 KB Output is correct
3 Incorrect 0 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -