QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#375509#2833. HamiltonFido_PuppyWA 1ms3792kbC++231.4kb2024-04-03 11:41:172024-04-03 11:41:18

Judging History

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

  • [2024-04-03 11:41:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3792kb
  • [2024-04-03 11:41:17]
  • 提交

answer

#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define MT make_tuple
#define IT iterator
#define fi first
#define se second
#define For(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define Rep(i, a, b) for (int i = (int)(a); i >= (int)(b); --i)
#define CLR(a, v) memset(a, v, sizeof(a))
#define CPY(a, b) memcpy(a, b, sizeof(a))
#define debug cerr << "ztxakking\n"
#define y0 ztxaknoi
#define y1 ztxakioi
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using vi = vector<int>;
template<typename T>
using V = vector<T>;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e3 + 7;
int n, a[N][N];
vi p;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  while (cin >> n) {
    For(i, 1, n) For(j, 1, n) {
      char c; cin >> c, a[i][j] = c - 48;
    }
    p.clear(), p = {1, 2};
    For(i, 2, n - 1) {
      For(j, 1, i - 1) if (a[p[j]][p[j - 1]] != a[p[j]][p[(j + 1) % i]]) {
        p.insert(p.begin() + j - (a[i + 1][p[j]] != a[p[j]][p[j - 1]]), i + 1);
        goto skip;
      }
      p.pb(i + 1);
      skip:;
    }
    for (int u : p) cout << u << ' ';
    cout << '\n';
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

3
001
000
100
4
0000
0000
0000
0000

output:

1 2 3 
1 2 3 4 

result:

ok 2 cases.

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3792kb

input:

3
000
000
000
3
010
100
000
3
011
100
100
3
011
101
110

output:

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

result:

wrong answer case #3: found 2 indices