結果
| 問題 |
No.466 ジオラマ
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-06-20 21:46:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,009 bytes |
| コンパイル時間 | 1,692 ms |
| コンパイル使用メモリ | 164,668 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-20 21:46:29 |
| 合計ジャッジ時間 | 5,198 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 83 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a,b,c,d;
int n,m;
vector<pair<int,int> > p;
int cnt=2;
signed main()
{
/*freopen("hometown.in","r",stdin);
freopen("hometown.out","w",stdout);*/
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>a>>b>>c>>d;
n=a+b-c;
m=n-1;
if(!c) m--;
if(a==c&&b==c) m=n;
if(n<2||m>d) return cout<<"-1",0;
if(a==c&&b==c)
{
for(int i=0;i<n;i++)
{
p.push_back({i,(i+1)%n});
}
}
else
{
for(int i=0;i<a-c-1;i++)
{
p.push_back({0,cnt});
cnt++;
}
for(int i=0;i<b-c-1;i++)
{
p.push_back({1,cnt});
cnt++;
}
if(c>0)
{
int flag=0;
if(c==a)
{
p.push_back({1,0});
flag=0;
}
else if(c==b)
{
p.push_back({0,1});
flag=1;
}
else
{
p.push_back({0,cnt});
p.push_back({1,cnt});
flag=cnt++;
}
for(int i=cnt;i<n;i++)
{
p.push_back({flag,i});
}
}
}
cout<<n<<" "<<m<<'\n';
for(auto xx:p)
{
cout<<xx.first<<" "<<xx.second<<'\n';
}
return 0;
}
vjudge1