QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#210689 | #5364. 面国漫步 | syf0 | 0 | 0ms | 4156kb | C++14 | 1.1kb | 2023-10-11 18:56:57 | 2023-10-11 18:56:57 |
answer
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define mk make_pair
const int N=10005,inf=1ll<<60;
using namespace std;
int n,k,a[N],v[N],maxn[N],dis[N],rev[N],cnt[N];
struct edge{int x,y,z;};
vector<edge>ans;
signed main()
{
freopen("meow1.in","r",stdin);
// freopen("meow.out","w",stdout);
ios::sync_with_stdio(false);cin.tie(0);
cin>>n>>k;
for(int i=2;i<=n;i++)dis[i]=inf;
for(int i=1;i<=k;i++)cin>>a[i],maxn[a[i]]=i;
for(int i=1;i<=n;i++)v[maxn[i]]=1;
for(int l=1,r=1;l<k;l=r+1)
{
r=l+1;
while(!v[r])r++;
cerr<<l<<' '<<r<<'\n';
for(int i=l;i<=r;i++)
{
if(cnt[a[i]]>0){cout<<"No\n";return 0;}
cnt[a[i]]++;
}
for(int i=l;i<=r;i++)cnt[a[i]]=0;
for(int i=l+1;i<r;i++)
{
dis[a[i]]--;rev[a[i]]=inf-dis[a[i]];
ans.emplace_back((edge){a[l],a[i],dis[a[i]]-dis[a[l]]});
}
ans.emplace_back((edge){a[l],a[r],rev[a[l]]});
dis[a[r]]=dis[a[l]]+rev[a[l]];
r--;
}
cout<<ans.size()<<'\n';
for(auto i:ans)cout<<i.x<<' '<<i.y<<' '<<i.z<<'\n';
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4000kb
input:
3 1 1
output:
0
result:
wrong answer Wrong Answer on the First line of output
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 4156kb
input:
85 78 1 46 49 66 12 47 36 28 44 17 48 34 5 82 20 40 69 52 75 27 14 43 53 83 33 55 38 77 58 56 76 81 6 84 19 80 67 3 50 25 26 21 29 62 70 22 68 63 74 37 7 73 78 42 32 2 64 8 39 71 59 18 23 24 9 51 85 11 57 41 45 16 54 30 35 61 72 4
output:
0
result:
wrong answer Wrong Answer on the First line of output
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%