結果
| 問題 | No.466 ジオラマ |
| コンテスト | |
| ユーザー |
👑 kmjp
|
| 提出日時 | 2016-12-16 00:53:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,598 bytes |
| 記録 | |
| コンパイル時間 | 1,511 ms |
| コンパイル使用メモリ | 165,668 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-30 09:26:04 |
| 合計ジャッジ時間 | 5,767 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 74 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:60:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘std::vector<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wformat=]
60 | _P("%d %d\n",ma+1,V.size());
| ^~~~~~~~~ ~~~~~~~~
| |
| std::vector<std::pair<int, int> >::size_type {aka long unsigned int}
main.cpp:6:30: note: in definition of macro ‘_P’
6 | #define _P(...) (void)printf(__VA_ARGS__)
| ^~~~~~~~~~~
main.cpp:60:25: note: format string is defined here
60 | _P("%d %d\n",ma+1,V.size());
| ~^
| |
| int
| %ld
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int A,B,C,D;
vector<pair<int,int>> V;
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>A>>B>>C>>D;
if(A==C && B==C) {
if(A==1) return _P("-1\n");
FOR(i,A) V.push_back({i,(i+1)%A});
}
else if(A==C) {
x=1,y=2;
FOR(i,B-A-1) V.push_back({x,y}),x=y++;
V.push_back({x,0});
x=0;
FOR(i,A-1) V.push_back({x,y}),x=y++;
}
else if(B==C) {
x=0,y=2;
FOR(i,A-B-1) V.push_back({x,y}),x=y++;
V.push_back({x,1});
x=1;
FOR(i,A-1) V.push_back({x,y}),x=y++;
}
else if(C==0) {
x=2;
FOR(i,A-1) V.push_back({0,x++});
FOR(i,B-1) V.push_back({1,x++});
}
else {
V.push_back({0,2});
V.push_back({1,2});
x=2,y=3;
FOR(i,C-1) V.push_back({x,y}),x=y++;
x=y;
FOR(i,A-(C+1)) V.push_back({0,x++});
FOR(i,B-(C+1)) V.push_back({1,x++});
}
if(V.size()>D) _P("-1\n");
else {
int ma=2;
FORR(v,V) ma=max(ma,max(v.first,v.second));
_P("%d %d\n",ma+1,V.size());
FORR(v,V) _P("%d %d\n",v.first,v.second);
}
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
kmjp