QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783210#6258. Find my Family353cerega#WA 1ms3596kbC++141.3kb2024-11-26 01:29:292024-11-26 01:29:31

Judging History

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

  • [2024-11-26 01:29:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3596kb
  • [2024-11-26 01:29:29]
  • 提交

answer

#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#include <bits/stdc++.h>

using namespace std;

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

#define X first
#define Y second


const ll mod = 1000000007;
//const ll mod = 998244353;



ll pew(ll a, ll b) {
    ll res = 1;
    while (b>0) {
        if (b&1) res = res*a%mod;
        b >>= 1;
        a = a*a%mod;
    }
    return res;
}



void solve() {
    ll T;
    cin >> T;
    vector<ll> A;
    for (ll t=1;t<=T;t++) {
        ll n;
        cin >> n;
        vector<ll> a(n);
        for (ll i=0;i<n;i++) cin >> a[i];
        vector<ll> mx(n+1);
        for (ll i=n-1;i>=0;i--) mx[i] = max(mx[i+1],a[i]);
        set<ll> kek;
        int ok = 0;
        for (ll i=0;i<n;i++) {
            auto it = kek.lower_bound(a[i]+1);
            if (it!=kek.end() and *it<mx[i+1]) {
                ok = 1;
                break;
            }
            kek.insert(a[i]);
        }
        if (ok==1) A.push_back(t);
    }
    cout << A.size() << "\n";
    for (ll x: A) cout << x << " ";
}

int main() {
    ios_base::sync_with_stdio(false);
    int T = 1;
    //cin >> T;
    while (T--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
3
2 1 3

output:

1
1 

result:

ok 2 lines

Test #2:

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

input:

4
4
140 157 160 193
5
15 24 38 9 30
6
36 12 24 29 23 15
6
170 230 320 180 250 210

output:

2
2 4 

result:

wrong answer 2nd lines differ - expected: '2', found: '2 4 '