QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#876148#7690. A Pivotal QuestionLaVuna47#WA 1ms3840kbC++201.9kb2025-01-30 17:45:402025-01-30 17:45:40

Judging History

This is the latest submission verdict.

  • [2025-01-30 17:45:40]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3840kb
  • [2025-01-30 17:45:40]
  • Submitted

answer

//A tree without skin will surely die.
//A man without face is invincible.
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif


int solve()
{
	int n;
	if(!(cin>>n))return 1;
	vector<int> a(n);
	FOR(i,0,n) cin>>a[i];
	vector<int> res;
	set<int> s1, s2;
	FOR(i,0,n)
		s2.insert(a[i]);
	FOR(i,0,n)
	{
		s2.erase(a[i]);
		if((s2.empty() || a[i] < (*s2.begin())) && (s1.empty() || a[i] > (*s1.rbegin())))
		{
			res.pb(a[i]);
		}
		s1.insert(a[i]);
	}
	if(sz(res) <= 100)
	{
		cout<<sz(res)<<' ';
		FOR(i,0,sz(res))
			cout<<res[i]<<" ";
		cout<<'\n';
	}
	else
	{
		FOR(i,0,100)
			cout<<res[i]<<" ";
		cout<<'\n';
	}
    return 0;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int TET = 1e9;
    //cin >> TET;
    for (int i = 1; i <= TET; i++)
    {
        if (solve())
        {
            break;
        }
#ifdef ONPC
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}

詳細信息

Test #1:

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

input:

10 1 11 8 13 53 20 63 99 79 94

output:

3 1 13 63 

result:

ok single line: '3 1 13 63 '

Test #2:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

3 9 8 7

output:

0 

result:

ok single line: '0 '

Test #3:

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

input:

3 7 8 9

output:

3 7 8 9 

result:

ok single line: '3 7 8 9 '

Test #4:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

2 1 10

output:

2 1 10 

result:

ok single line: '2 1 10 '

Test #5:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

2 10 1

output:

0 

result:

ok single line: '0 '

Test #6:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1 5

output:

1 5 

result:

ok single line: '1 5 '

Test #7:

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

input:

1000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 

result:

wrong answer 1st lines differ - expected: '1000 1 2 3 4 5 6 7 8 9 10 11 1... 91 92 93 94 95 96 97 98 99 100', found: '1 2 3 4 5 6 7 8 9 10 11 12 13 ...91 92 93 94 95 96 97 98 99 100 '