QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#411410 | #6765. Don't Really Like How The Story Ends | xiaole | WA | 235ms | 8364kb | C++23 | 990b | 2024-05-15 13:00:57 | 2024-05-15 13:00:57 |
Judging History
answer
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;using ll = long long;using PLL = pair<ll,ll>;
const ll MAX = 1e18;const ll MIN = -1e18;const ll INF=0x3f3f3f3f;
const ll Q = 1e5+9;const ll MOD = 1e9 + 7;
set<ll> d[Q];ll ans;
bool vis[Q];ll n,m;
ll now=1;
void dfs(ll x){
for(auto i:d[x]){
if(i<now+1) continue;
while(i>=now+1)
{
if(i==now+1){
now++;
dfs(i);
}else{
ans++;
now++;
dfs(now);
}
}
}
}
void solve(){
cin>>n>>m;
memset(vis,0,sizeof vis);
ans=0;now=1;
for (ll i = 0; i <= n; i++) d[i].clear();
for (ll i = 0; i < m; i++)
{
ll o,p;cin>>o>>p;
if(p>o) d[o].insert(p);
}
d[1].insert(n+1);
dfs(1);
cout<<ans<<"\n";
}
int main(){
ios;ll _=1;cin>>_;
while (_--)solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 8364kb
input:
3 2 3 1 1 1 2 2 1 4 1 1 4 4 2 1 2 3 4
output:
0 2 1
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 235ms
memory: 8284kb
input:
117747 3 7 2 1 3 3 1 3 1 1 3 2 1 1 3 1 4 8 2 3 4 3 3 2 4 2 1 3 2 1 4 3 2 4 3 4 2 3 2 2 3 3 1 1 2 5 1 1 2 2 2 2 1 2 2 2 3 7 2 1 1 2 3 3 3 2 1 2 3 3 3 2 4 5 1 2 3 3 4 4 1 4 2 1 3 1 3 2 1 3 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 5 4 2 1 2 5 1 3 3 2 4 7 1 1 2 4 3 2 1 1 1 1 4 2 2 3 5 8 3 3 2 2 4 2 1 4 1...
output:
1 1 1 0 1 1 2 0 0 3 1 2 1 0 3 1 2 0 2 0 0 4 0 0 1 3 1 1 1 0 0 0 1 1 3 1 4 0 2 1 3 1 4 1 0 0 1 4 0 3 2 2 3 2 1 3 0 0 1 1 1 3 2 2 0 0 1 0 0 3 3 0 1 0 1 0 2 4 0 2 2 1 2 1 0 2 2 3 0 1 2 1 2 0 3 2 1 3 1 0 3 0 0 1 1 0 1 0 0 0 0 4 0 1 0 0 1 0 2 1 2 1 0 1 0 0 0 2 0 2 0 2 1 2 1 1 2 2 1 3 0 2 0 1 1 2 1 1 1 1 ...
result:
wrong answer 1st lines differ - expected: '0', found: '1'