QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#834 | #571761 | #9310. Permutation Counting 4 | N_z_ | ship2077 | Failed. | 2024-09-18 14:55:22 | 2024-09-18 14:55:24 |
Details
Extra Test:
Accepted
time: 2865ms
memory: 492980kb
input:
2 524288 1 1 1 2 2 3 1 4 2 5 3 6 4 7 1 8 2 9 3 10 4 11 5 12 6 13 7 14 8 15 1 16 2 17 3 18 4 19 5 20 6 21 7 22 8 23 9 24 10 25 11 26 12 27 13 28 14 29 15 30 16 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 40 10 41 11 42 12 43 13 44 14 45 15 46 16 47 17 48 18 49 19 50 20 51 21 52 22 53 23 54 24 55 25 ...
output:
1 1
result:
ok 2 tokens
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#571761 | #9310. Permutation Counting 4 | ship2077# | TL | 842ms | 194040kb | C++23 | 573b | 2024-09-18 08:15:04 | 2024-10-14 07:43:44 |
answer
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
constexpr int M=1e6+5;
set<int>s[M];int n;
void solve(){ cin>>n;
for (int i=1;i<=n;i++) s[i].clear();
for (int i=1;i<=n;i++){
int l,r;cin>>l>>r;
s[l].insert(r);
}
for (int i=1;i<=n;i++){
if (s[i].empty()) return puts("0"),void();
int lst=0;
for (auto x:s[i]){
if (lst) s[lst+1].insert(x);
lst=x;
}
}
puts("1");
}
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int T;cin>>T;while (T--) solve();return 0;
}