QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#363217#8258. Gift Exchangeksu_#10 80ms9080kbC++142.7kb2024-03-23 19:38:152024-07-04 03:30:45

Judging History

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

  • [2024-07-04 03:30:45]
  • 评测
  • 测评结果:10
  • 用时:80ms
  • 内存:9080kb
  • [2024-03-23 19:38:15]
  • 提交

answer

#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#include <unordered_map>
#include <unistd.h>

using namespace std;
typedef long long ll;

vector<string> word = {"hello", "hiya", "hi", "hey", "heeey"};

void blank(ll p){
    for(int i = 0; i < p; i++)
        cout << ' ';
}
void solve(ll k){
    ll p = rand() % 100;
    
    blank(p);
    for(int i = 0; i < k + 2; i++)
        cout << '-';
    cout << endl;
    for(int i = 0; i < k; i++){
        blank(p);
        cout << '|';
//        string s = "ffffffffffffffffff";
//        while(s.size() > k)
//            s = word[rand() % word.size()];
//        
//        cout << s;
        for(int j = 0; j < k; j++)
            cout << ' ';
        cout << '|';
        cout << endl;
    }
    blank(p);
    for(int i = 0; i < k + 2; i++)
        cout << '-';
    cout << endl;
}

ll prev0 = 50;

void distr(){
    prev0 = (rand() % 2 ? -1 : 1) + prev0;
    blank(prev0);
    cout << '*' << endl;
}

int main(){
    srand(time(0));
    ll n;
    cin >> n;
    
    vector<pair<ll, ll>> a(n);
    for(auto &i: a)
        cin >> i.first;
    for(auto &i: a)
        cin >> i.second;
    
    ll q;
    cin >> q;
    
    vector<ll> a_to_b(2 * n + 1);
    for(int i = 0; i < n; i++)
        a_to_b[a[i].first] = a[i].second;
    
    while(q--){
        ll l, r;
        cin >> l >> r;
        
        l--, r--;
        
        vector<ll>a0, b;
        for(int i = l; i <= r; i++){
            a0.push_back(a[i].first);
            b.push_back(a[i].second);
        }
        sort(a0.begin(), a0.end());
        sort(b.begin(), b.end());
        vector<ll> dist(r - l + 3);
        dist[b.size()] = b.size();
        
        bool ok = false;
        ll ind = a0.size();
        
        for(int i = b.size() - 1; i >= 0; i--){
            while(ind - 1 >= 0 && a0[ind - 1] > b[i])
                ind--;
            
            if(dist[i] > i){
                ok = true;
                break;
            }
            
            dist[i] = ind;
            
            if(a_to_b[a0[i]] == b[i] && dist[i] == i){
                ok = true;
                break;
            }
        }
        
        cout << (ok ? "No" : "Yes") << endl;
    }
    
    return 0;
}
/*
 10
 2 5 8 10 12 14 16 17 19 20
 1 4 7 6 11 13 9 3 18 15
 1
 5 8
 */
// 12 14 16 17
// 11 13 9 3
/*
 4
 3 8 5 7
 2 6 1 4
 1
 3 4
 
 */

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

10
13 14 16 18 17 19 20 8 6 4
7 12 15 2 11 10 9 3 5 1
10
2 3
1 6
1 7
5 8
1 10
2 6
5 10
3 6
3 7
4 7

output:

No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes

result:

wrong answer expected YES, found NO [5th token]

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 10
Accepted

Test #30:

score: 10
Accepted
time: 46ms
memory: 8976kb

input:

100000
200000 87337 190412 58171 10676 178924 155670 153538 106523 166320 196463 174807 19706 66971 196345 114283 119288 59218 155349 194059 154822 98022 199346 153510 145408 187388 174214 150932 65211 35112 20551 176504 139581 41024 52730 150416 18789 190510 108780 47812 169962 158959 135239 191992...

output:

Yes

result:

ok YES

Test #31:

score: 0
Accepted
time: 50ms
memory: 8992kb

input:

99996
199992 55108 192122 156535 96703 158022 98612 154080 174501 80333 191718 138961 171355 154101 62771 14226 197265 155606 29245 170843 138895 82846 166147 165740 146215 131388 86029 172891 136364 149984 101524 192965 86471 145997 174545 141753 76373 143913 197383 78031 92038 142017 128688 134591...

output:

Yes

result:

ok YES

Test #32:

score: 0
Accepted
time: 50ms
memory: 8996kb

input:

99999
199997 170879 161773 28645 163801 191566 171319 165453 53288 132456 157500 91941 146443 170074 93531 161983 19502 64479 129891 144995 171001 161313 193878 181848 137588 99441 195737 143467 111802 194680 190788 115429 120877 169533 140028 197536 31383 148612 118644 93306 188532 134687 93192 735...

output:

Yes

result:

ok YES

Test #33:

score: 0
Accepted
time: 46ms
memory: 9072kb

input:

99998
199995 171377 133250 170806 197343 162890 176641 198229 156952 106802 148078 134198 38360 182569 58669 116012 120742 177680 93529 99582 123704 150105 171634 107951 125500 163732 179649 88588 39234 198625 121214 176445 63415 179868 187758 171381 182891 158588 157548 88592 171267 76505 73211 320...

output:

Yes

result:

ok YES

Test #34:

score: 0
Accepted
time: 50ms
memory: 9080kb

input:

99994
199986 176184 128449 165655 180411 108099 175456 183507 96091 70117 144956 115377 154518 160497 55545 181168 131848 118193 156102 182500 168439 63241 171910 127138 197292 163655 42841 94923 164742 143990 146191 166736 107846 141059 183167 82715 147429 71721 89024 132050 176003 157826 80392 158...

output:

Yes

result:

ok YES

Test #35:

score: 0
Accepted
time: 42ms
memory: 8940kb

input:

99992
199982 94622 159310 166234 105469 44414 52091 123694 172916 179711 149323 115375 166040 92513 67125 146185 197622 76337 98286 145089 106898 45508 188859 181520 186912 62260 77767 114546 103202 139705 181802 79604 153783 143459 173771 53329 161991 122820 59148 175497 171100 191733 170006 112486...

output:

Yes

result:

ok YES

Test #36:

score: 0
Accepted
time: 49ms
memory: 9072kb

input:

99994
199986 172588 101761 173680 154796 47906 165246 155807 142583 82053 124298 185751 146473 152843 53592 189568 141547 56758 179491 145227 199189 152477 77578 119916 185291 113298 199873 172624 155978 67770 48535 89031 186445 190000 86320 101939 89859 95948 119667 111209 45026 105189 107948 49321...

output:

No

result:

ok NO

Test #37:

score: 0
Accepted
time: 42ms
memory: 8972kb

input:

99992
199982 109852 155026 157923 110059 91615 184436 197597 189940 165799 197946 168174 61274 182820 197704 185711 79614 179286 55824 153991 71910 157841 175794 134500 29170 66409 76993 183438 161616 88974 76217 121790 147837 134276 136205 106385 89486 107495 102229 187620 174748 76130 75940 194935...

output:

No

result:

ok NO

Test #38:

score: 0
Accepted
time: 46ms
memory: 8940kb

input:

100000
199999 74639 195073 197398 179979 168474 145783 79979 159184 131687 174609 183930 160341 68420 127730 176972 164251 182791 133617 83641 167951 133542 35978 163253 187454 122787 187615 85608 79476 125951 114704 188425 93638 120054 192421 174834 106180 42561 71789 170972 180724 95208 199400 117...

output:

Yes

result:

ok YES

Subtask #4:

score: 0
Wrong Answer

Test #39:

score: 31
Accepted
time: 61ms
memory: 7124kb

input:

74998
147369 94378 68913 123990 65257 88482 116281 130255 78568 141536 99818 113372 26849 44703 95080 48018 147366 120676 91071 19208 101933 124465 78741 140833 90216 52837 145872 105601 142557 113425 86814 84542 101123 108992 78297 100014 104368 69638 40964 118227 76398 117479 115743 72849 102952 1...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 10, no count is 0

Test #40:

score: 0
Accepted
time: 67ms
memory: 8240kb

input:

100000
170854 85803 190478 195356 68149 101079 160091 179386 130394 139476 179555 126978 167547 72065 161727 131638 174824 164983 186730 137165 199164 176656 182858 115220 171372 182351 157236 123780 62649 186367 133008 181264 148394 194183 128269 58610 118326 47996 183674 131477 91894 76140 154928 ...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 10, no count is 0

Test #41:

score: 0
Accepted
time: 27ms
memory: 6644kb

input:

72263
130381 105716 139143 33477 86587 120207 73233 38155 92520 125495 23580 69974 121855 74665 137812 18565 132361 95705 128027 144100 124410 59047 128296 55909 122780 117585 50625 136320 49469 99327 72567 114712 39178 85774 98604 91033 96296 129069 106417 137597 55731 103597 92014 133512 101043 10...

output:

Yes
Yes
Yes
No
No
No
No
Yes
Yes
No

result:

ok 10 token(s): yes count is 5, no count is 5

Test #42:

score: 0
Accepted
time: 58ms
memory: 8208kb

input:

100000
126626 150000 164533 93954 84178 127720 196307 191298 197000 58182 74847 177055 162414 81634 197421 66855 75160 114529 152612 39251 195125 173835 185089 111782 87465 123997 67067 47121 108359 155858 183706 177604 157701 150153 132993 179460 130275 74441 147142 158401 175469 194555 174393 1407...

output:

Yes
No
No
Yes
No
Yes
No
No
Yes
Yes

result:

ok 10 token(s): yes count is 5, no count is 5

Test #43:

score: 0
Accepted
time: 80ms
memory: 8812kb

input:

98148
12647 155973 20767 36805 168027 146372 113253 66852 57625 1895 12580 165096 49832 70925 51643 104757 37054 65869 192814 19113 33302 2095 107427 178717 180641 23141 25274 164150 81130 106741 49558 145423 35903 177929 194630 68466 115774 120908 107796 114055 18798 78402 188605 138386 106234 5350...

output:

Yes
No
No
Yes
No
No
No
No
No
No

result:

ok 10 token(s): yes count is 2, no count is 8

Test #44:

score: -31
Wrong Answer
time: 65ms
memory: 8952kb

input:

100000
10705 194107 21546 73701 152844 24382 42696 113958 60425 157337 37450 71952 62746 111551 19905 160604 108607 112452 11252 38865 119652 144352 121417 134813 133291 136001 199480 196487 185112 105850 198182 167163 17348 115046 28792 99322 28320 73922 133873 46997 31716 155771 165925 157474 311 ...

output:

No
No
No
No
Yes
No
Yes
Yes
Yes
Yes

result:

wrong answer expected YES, found NO [1st token]

Subtask #5:

score: 0
Time Limit Exceeded

Test #52:

score: 0
Time Limit Exceeded

input:

71726
4 5 7 10 11 17 20 24 26 27 28 29 31 35 36 38 40 42 44 46 48 50 51 52 55 56 57 59 61 62 66 68 69 70 72 73 75 78 79 83 85 86 91 93 96 97 98 100 105 107 108 109 110 111 112 113 116 117 120 124 125 126 127 129 132 133 135 139 144 145 146 148 149 152 153 154 156 157 159 161 163 165 167 173 174 178 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:


Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

0%