QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#247910#7619. Make SYSU Great Again Iucup-team228#WA 1ms3896kbC++173.3kb2023-11-11 16:32:132023-11-11 16:32:14

Judging History

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

  • [2023-11-11 16:32:14]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3896kb
  • [2023-11-11 16:32:13]
  • 提交

answer

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <chrono>
#include <random>
#include <string>
#include <numeric>
#include <complex>
#include <tuple>
#include <utility>
#include <bitset>
#include <array>
#include <stack>
#include <sstream>

using namespace std;
typedef long long ll;
 
string to_string(string a) { return '"' + a + '"'; }
string to_string(char a) { return "'" + string(1, a) + "'"; }
string to_string(const char* a) { return to_string((string) a); }
string to_string(bool a) { return a ? "true" : "false"; }
template <class T1, class T2>
string to_string(pair<T1, T2> a) {
    return "(" + to_string(a.first) + ", " + to_string(a.second) + ")";
}
template <class T>
string to_string(T a) {
    bool first = true; string res = "{";
    for (const auto& i : a) {
        if (!first) res += ", ";
        first = false;
        res += to_string(i);
    }
    res += "}";
    return res;
}
void debug_out() { cerr << endl; }
template <class T1, class... T2>
void debug_out(T1 a, T2... b) {
    cerr << " " << to_string(a);
    debug_out(b...);
}
 
#ifdef LOCAL
#define out(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define out(...) 42
#endif

clock_t start_time; void start_timer() { start_time = clock(); }
double get_time() { return (double) (clock() - start_time) / CLOCKS_PER_SEC; }

void Solve();

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("usr/share/man/man1/input.txt", "r", stdin);
#endif
    start_timer();
    Solve();
#ifdef LOCAL
    cerr << fixed << setprecision(3);
    cerr << endl << "Time spent: " << get_time() << endl;
#endif
    return 0;
}

// do something, stay focused
// look for stupid bugs
// guess, slow, stress
// don't overgeneralize
// don't rush

// don't waste time on standings

// SOLVE THE PROBLEM OR DIE TRYING
// THE SOLUTION IS ALWAYS SIMPLE
// THE CODE IS ALWAYS SHORT

const int N = 1e6 + 5;

set<pair<int, int>> used;
pair<int, int> ans[N];

void Solve() {
    int n, k;
    cin >> n >> k;
    int ptr = 0;
    if (n % 2 == 0) {
        for (int i = 1; i <= n; i += 2) {
            if (ptr == k) break;
            ans[++ptr] = {i, i};
            ans[++ptr] = {i, i + 1};
            ans[++ptr] = {i + 1, i};
            ans[++ptr] = {i + 1, i + 1};
        }
    }
    else {
        ans[++ptr] = {1, 1};
        ans[++ptr] = {1, 2};
        ans[++ptr] = {2, 2};
        ans[++ptr] = {2, 3};
        ans[++ptr] = {3, 3};
        ans[++ptr] = {3, 1};
        for (int i = 4; i <= n; i += 2) {
            if (ptr == k) break;
            ans[++ptr] = {i, i};
            ans[++ptr] = {i, i + 1};
            ans[++ptr] = {i + 1, i};
            ans[++ptr] = {i + 1, i + 1};
        }
    }
    for (int i = 1; i <= ptr; i++) {
        used.insert(ans[i]);
    }
    for (int i = 1; i <= n; i++) {
        if (ptr == k) break;
        for (int j = 1; j <= n; j++) {
            if (ptr == k) break;
            if (used.count({i, j})) continue;
            ans[++ptr] = {i, j};
        }
    }
    for (int i = 1; i <= k; i++) {
        cout << ans[i].first << " " << ans[i].second << "\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3808kb

input:

3 6

output:

1 1
1 2
2 2
2 3
3 3
3 1

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3896kb

input:

3 7

output:

1 1
1 2
2 2
2 3
3 3
3 1
1 3

result:

ok The answer is correct.

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3696kb

input:

2 4

output:

1 1
1 2
2 1
2 2

result:

wrong answer The answer is wrong: The maximum common divisor of row 2 and column 691430528 is not the same.