QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#94493#5253. Denormalizationmaomao90#RE 0ms0kbC++171.9kb2023-04-06 14:11:342023-04-06 14:11:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-06 14:11:35]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-04-06 14:11:34]
  • 提交

answer


// Hallelujah, praise the one who set me free
// Hallelujah, death has lost its grip on me
// You have broken every chain, There's salvation in your name
// Jesus Christ, my living hope
#include <bits/stdc++.h> 
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define RREP(i, s, e) for (int i = (s); i >= (e); i--)
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define SZ(_a) (int) _a.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;

#ifndef DEBUG
#define cerr if (0) cerr
#endif

const int INF = 1000000005;
const ll LINF = 1000000000000000005ll;
const int MAXN = 100005;
const int MOD1 = 998244353;
const int MOD2 = 1000000007;

int n, m, k;
string s[MAXN];
ll x[MAXN];
ll col[MAXN][4];

int main() {
#ifndef DEBUG
    ios::sync_with_stdio(0), cin.tie(0);
#endif
    mt19937 rnd(8);
    cin >> n >> m >> k;
    REP (i, 0, n) {
        cin >> s[i];
        x[i] = rnd();
    }
    REP (i, 0, n) {
        REP (j, 0, m) {
            col[j][s[i][j] - 'A'] += x[i];
        }
    }
    ll t1 = 0, t2 = 0;
    REP (i, 0, n) {
        t1 = (t1 + x[i] * (m - k)) % MOD1;
        t2 = (t2 + x[i] * (m - k)) % MOD2;
    }
    int ans = -1;
    REP (i, 0, n) {
        ll c1 = 0, c2 = 0;
        REP (j, 0, m) {
            c1 = (c1 + col[j][s[i][j] - 'A']) % MOD1;
            c2 = (c2 + col[j][s[i][j] - 'A']) % MOD2;
        }
        ll n1 = (t1 + x[i] * k) % MOD1;
        ll n2 = (t2 + x[i] * k) % MOD2;
        if (c1 == n1 && c2 == n2) {
            assert(ans == -1);
            ans = i;
        }
    }
    cout << ans + 1 << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

2
0.909840249060
0.414958698174

output:


result: