QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#590456#8061. Add or Multiplynickbelov#WA 0ms3500kbC++202.6kb2024-09-26 00:22:142024-09-26 00:22:14

Judging History

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

  • [2024-09-26 00:22:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3500kb
  • [2024-09-26 00:22:14]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename T>
ostream_iterator<T> oit(const string &s = " "){ return ostream_iterator<T>(cout,s.c_str()); }
inline auto rep(int l, int r) { return views::iota(min(l, r), r); }
inline auto rep(int n) { return rep(0, n); }
inline auto rep1(int l, int r) { return rep(l, r + 1); }
inline auto rep1(int n) { return rep(1, n + 1); }
inline auto per(int l, int r) { return rep(l, r) | views::reverse; }
inline auto per(int n) { return per(0, n); }
inline auto per1(int l, int r) { return per(l, r + 1); }
inline auto per1(int n) { return per(1, n + 1); }
#define A(a) begin(a),end(a)
inline auto len = ranges::ssize;

struct chash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template<typename T, typename U> using pb_map = gp_hash_table<T, U, chash>;
template<typename T> using pb_set = gp_hash_table<T, null_type, chash>;
#define K first
#define V second

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vii = vector<vector<int>>;
typedef vector<ll> vll;
using pll = pair<ll,ll>;
using pii = pair<int,int>;

constexpr ll NN = 2e5, M = 1000000007, L = 20;

ll f1[NN], f2[NN];
ll inv(ll a, ll b=M) { return 1 < a ? b - inv(b % a, a) * b / a : 1; } // inv a mod b
ll choose(ll n, ll k) { return f1[n] * f2[k] % M * f2[n - k] % M; } // n choose k

void run()
{
    int n,m,q; cin >> n >> m >> q;
    vector<string> p(n);
    for(auto &s : p) cin >> s;
    string pattern(m,'?');
    while(q--){
        int idx; cin >> idx; char c; cin >> c; --idx;
        pattern[idx]=c;
    }

    vector<int> cand;
    for(int i : rep(n)){
        bool good = true;
        for(int j : rep(m)){
            if(pattern[j]=='?') continue;
            good and_eq p[i][j]==pattern[j];
        }
        if(good) cand.push_back(i+1);
    }
    
    if(len(cand)==1){
        cout << "unique\n";
        cout << cand[0] << '\n';
    }else{
        cout << "ambiguous\n";
        cout << len(cand) << '\n';
    }
}

int main()
{
    //KING OF THE WORLD...... U.W.T.B
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    run();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3500kb

input:

3 4
2+3*4
s 1 2
a
f 2
a

output:

ambiguous
0

result:

wrong answer 1st lines differ - expected: '14', found: 'ambiguous'