QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#109229#5456. Big PictureckisekiWA 2ms3380kbC++201.9kb2023-05-27 22:53:442023-05-27 22:53:47

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-27 22:53:47]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3380kb
  • [2023-05-27 22:53:44]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#ifdef CKISEKI
#define safe cerr<<__PRETTY_FUNCTION__\
    <<" line "<<__LINE__<<" safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
using std::cerr;
template <typename ...T>
void debug_(const char *s, T ...a) {
    cerr << "\e[1;32m(" << s << ") = (";
    int cnt = sizeof...(T);
    (..., (cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename I>
void orange_(const char *s, I L, I R) {
    cerr << "\e[1;32m[ " << s << " ] = [ ";
    for (int f = 0; L != R; ++L)
        cerr << (f++ ? ", " : "") << *L;
    cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) ((void)0)
#define orange(...) ((void)0)
#endif

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int T;
    cin >> T;
    while (T--) {
        int n, m;
        cin >> n >> m;

        vector<vector<int>> a(n, vector<int>(m));
        vector<tuple<int,int,int>> t;
        set<pair<int,int>> st;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cin >> a[i][j];
                t.emplace_back(a[i][j], i, j);
            }
        }

        sort(t.begin(), t.end());
        st.insert({ -1, -1 });
        st.insert({ n+1, m+1 });
        int ans = 0;
        for (auto [val, i, j]: t) {
            auto [it, succ] = st.insert({ i, j });
            if (j > prev(it)->second && j > next(it)->second) {
                break;
            }
            if (j < prev(it)->second && j < next(it)->second) {
                break;
            }
            if (i > prev(it)->first && i > next(it)->first) {
                break;
            }
            if (i < prev(it)->first && i < next(it)->first) {
                break;
            }

            ans = val + 1;
        }
        cout << ans << '\n';

    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3380kb

input:

3 3
0 0 1
1 0 0
0 0 1
0 1 0
0 0 0
1 0 1

output:

0
0
0

result:

wrong answer 1st numbers differ - expected: '3', found: '0'