QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#733708#6636. Longest Strictly Increasing SequenceVedant18#AC ✓3ms3792kbC++232.2kb2024-11-10 20:35:132024-11-10 20:35:14

Judging History

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

  • [2024-11-10 20:35:14]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3792kb
  • [2024-11-10 20:35:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define in(a, b) for (ll i = (a); i <= (b); i++)                // in using i
#define inj(a, b) for (ll j = (a); j <= (b); j++)               // in using j
#define ink(a, b) for (ll k = (a); k <= (b); k++)               // in using k
#define inl(a, b) for (ll l = (a); l <= (b); l++)               // in using l
#define inr(a, b) for(ll i = (a); i >= (b); i--)                // in reverse
#define inrj(a, b) for(ll j = (a); j >= (b); j--)                // in reverse
#define inrk(a, b) for(ll k = (a); k >= (b); k--)                // in reverse
#define inrl(a, b) for(ll l = (a); l >= (b); l--)                // in reverse
#define tt ll tcs; cin>>tcs; while(tcs--)                       // include test cases
#define ina(arr,n) ll arr[(n+1)]={0}; in(1,n) cin>>arr[i]       // input arr of n elements
#define inv(vec,n) vector<ll> vec(n+1); vec[0]=0; in(1,n) cin>>vec[i]; // input vector of n elements
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pll pair <ll,ll>
#define vpll vector <pll>
#define sll set <ll>
#define vll vector<ll>
#define mll map <ll,ll>
#define all(x) x.begin(), x.end()
const ll mod=1e9+7;
#define vvll vector<vll>
#define pref(p,a,n) vll p(n+1); in(1,n) p[i]=p[i-1]+a[i];
#define vec2(a,n,m) vvll a(n+1,vll(m+1))
// #define vec2(a,n,m,val) vvll a(n+1,vll(m+1,val))

#define vec3(a,l,m,n) vector<vvll>a(l+1,vvll(m+1,vll(n+1)));
// #define vec3(a,l,m,n,val) vector<vvll>a(l+1,vvll(m+1,vll(n+1,val)));
# define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main(){
    FAST
    tt{
        ll n;
        cin>>n;
        inv(a,n);
        bool ok=1;
        in(1,n){
            if(a[i]<a[i-1]){
                ok=0;
            }
            else if(a[i]==a[i-1]){

            }
            else if(a[i]==(a[i-1]+1)){

            }
            else{
                ok=0;
            }
        }
        if(ok){
            cout<<"YES\n";
            in(1,n){
                cout<<a[i]<<' ';
            }
            cout<<endl;
        }
        else{
            cout<<"NO\n";
        }

    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
6
1 2 3 2 5 7
2
1 2

output:

NO
YES
1 2 

result:

ok t=2 (2 test cases)

Test #2:

score: 0
Accepted
time: 3ms
memory: 3792kb

input:

3483
5
2 3 5 1 1
2
8 1
10
1 2 3 4 4 5 6 6 6 7
10
1 1 2 2 2 2 3 4 4 5
2
5 8
3
7 10 8
5
4 1 3 3 8
10
1 2 2 2 2 2 2 3 3 3
10
1 1 2 3 4 5 5 5 5 6
9
1 2 3 4 5 5 6 6 7
7
8 8 8 8 9 1 2
5
8 9 8 3 5
10
1 2 3 3 3 3 4 4 4 5
5
7 1 6 4 3
7
5 6 8 6 1 5 5
10
1 2 2 3 4 4 4 4 5 5
3
10 4 5
3
1 5 3
5
2 8 1 2 1
3
7 8 3...

output:

NO
NO
YES
1 2 3 4 4 5 6 6 6 7 
YES
1 1 2 2 2 2 3 4 4 5 
NO
NO
NO
YES
1 2 2 2 2 2 2 3 3 3 
YES
1 1 2 3 4 5 5 5 5 6 
YES
1 2 3 4 5 5 6 6 7 
NO
NO
YES
1 2 3 3 3 3 4 4 4 5 
NO
NO
YES
1 2 2 3 4 4 4 4 5 5 
NO
NO
NO
NO
NO
NO
YES
1 1 1 2 2 3 3 4 4 
NO
NO
NO
NO
NO
NO
NO
YES
1 2 3 3 3 4 4 4 5 5 
YES
1 1 2 2 2...

result:

ok t=3483 (3483 test cases)