Submission #17631271


Source Code Expand

Copy
#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 FORR2(x,y,arr) for(auto& [x,y]: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 N,M;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	vector<pair<int,int>> ret;
	
	if(M>0) {
		if(M>N-2) {
			cout<<-1<<endl;
			return;
		}
		ret.push_back({1,500000});
		FOR(i,M+1) {
			ret.push_back({10+i*2,10+i*2+1});
		}
		FOR(i,N-(M+2)) ret.push_back({500010+i*2,500010+i*2+1});
	}
	else if(M==0) {
		FOR(i,N) ret.push_back({10+i*2,10+i*2+1});
	}
	else {
		cout<<-1<<endl;
		return;
	}
	
	FORR(r,ret) {
		cout<<r.first<<" "<<r.second<<endl;
	}
}


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);
	cout.tie(0); solve(); return 0;
}

Submission Info

Submission Time
Task C - Solutions
User kmjp
Language C++ (GCC 9.2.1)
Score 500
Code Size 1241 Byte
Status AC
Exec Time 289 ms
Memory 5324 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:20:8: warning: unused variable ‘j’ [-Wunused-variable]
   20 |  int i,j,k,l,r,x,y; string s;
      |        ^
./Main.cpp:20:10: warning: unused variable ‘k’ [-Wunused-variable]
   20 |  int i,j,k,l,r,x,y; string s;
      |          ^
./Main.cpp:20:12: warning: unused variable ‘l’ [-Wunused-variable]
   20 |  int i,j,k,l,r,x,y; string s;
      |            ^
./Main.cpp:20:14: warning: unused variable ‘r’ [-Wunused-variable]
   20 |  int i,j,k,l,r,x,y; string s;
      |              ^
./Main.cpp:20:16: warning: unused variable ‘x’ [-Wunused-variable]
   20 |  int i,j,k,l,r,x,y; string s;
      |                ^
./Main.cpp:20:18: warning: unused variable ‘y’ [-Wunused-variable]
   20 |  int i,j,k,l,r,x,y; string s;
      |                  ^
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:7:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    7 | #define FOR(x,to) for(x=0;x<(to);x++)
      |                            ^
./Main.cpp:53:38: note: in expansion of macro ‘FOR’
   53 |  FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
      |                                      ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 54
Set Name Test Cases
Sample 00-Sample-00, 00-Sample-01
All 00-Sample-00, 00-Sample-01, 01-N103497M97981, 01-N10M-1, 01-N10M-10, 01-N10M-2, 01-N10M-3, 01-N10M-4, 01-N10M-5, 01-N10M-6, 01-N10M-7, 01-N10M-8, 01-N10M-9, 01-N10M0, 01-N10M1, 01-N10M10, 01-N10M2, 01-N10M3, 01-N10M4, 01-N10M5, 01-N10M6, 01-N10M7, 01-N10M8, 01-N10M9, 01-N11431M1531, 01-N123857M109412, 01-N133447M71060, 01-N139679M46985, 01-N161868M156803, 01-N163982M79925, 01-N168417M143637, 01-N1M0, 01-N200000M-1, 01-N200000M-100000, 01-N200000M-200000, 01-N200000M0, 01-N200000M1, 01-N200000M100000, 01-N200000M199998, 01-N200000M199999, 01-N200000M2, 01-N200000M200000, 01-N23355M10651, 01-N24593M15890, 01-N31932M26393, 01-N36426M9434, 01-N36991M31877, 01-N48772M22606, 01-N60522M40319, 01-N63340M21398, 01-N7775M948, 01-N86918M73878, 01-N87940M11203, 01-N95728M66299
Case Name Status Exec Time Memory
00-Sample-00 AC 6 ms 3608 KB
00-Sample-01 AC 3 ms 3500 KB
01-N103497M97981 AC 157 ms 4140 KB
01-N10M-1 AC 6 ms 3516 KB
01-N10M-10 AC 2 ms 3608 KB
01-N10M-2 AC 2 ms 3560 KB
01-N10M-3 AC 2 ms 3560 KB
01-N10M-4 AC 2 ms 3600 KB
01-N10M-5 AC 2 ms 3608 KB
01-N10M-6 AC 2 ms 3580 KB
01-N10M-7 AC 2 ms 3504 KB
01-N10M-8 AC 2 ms 3560 KB
01-N10M-9 AC 1 ms 3616 KB
01-N10M0 AC 2 ms 3472 KB
01-N10M1 AC 2 ms 3580 KB
01-N10M10 AC 2 ms 3644 KB
01-N10M2 AC 2 ms 3584 KB
01-N10M3 AC 5 ms 3608 KB
01-N10M4 AC 2 ms 3616 KB
01-N10M5 AC 2 ms 3620 KB
01-N10M6 AC 1 ms 3648 KB
01-N10M7 AC 2 ms 3612 KB
01-N10M8 AC 2 ms 3660 KB
01-N10M9 AC 2 ms 3572 KB
01-N11431M1531 AC 31 ms 3792 KB
01-N123857M109412 AC 180 ms 4280 KB
01-N133447M71060 AC 192 ms 5324 KB
01-N139679M46985 AC 201 ms 5152 KB
01-N161868M156803 AC 232 ms 5228 KB
01-N163982M79925 AC 235 ms 5188 KB
01-N168417M143637 AC 240 ms 5284 KB
01-N1M0 AC 8 ms 3568 KB
01-N200000M-1 AC 2 ms 3576 KB
01-N200000M-100000 AC 2 ms 3612 KB
01-N200000M-200000 AC 2 ms 3580 KB
01-N200000M0 AC 287 ms 5256 KB
01-N200000M1 AC 289 ms 5264 KB
01-N200000M100000 AC 282 ms 5148 KB
01-N200000M199998 AC 287 ms 5224 KB
01-N200000M199999 AC 7 ms 3568 KB
01-N200000M2 AC 284 ms 5252 KB
01-N200000M200000 AC 10 ms 3616 KB
01-N23355M10651 AC 38 ms 3712 KB
01-N24593M15890 AC 48 ms 3732 KB
01-N31932M26393 AC 53 ms 3652 KB
01-N36426M9434 AC 63 ms 3888 KB
01-N36991M31877 AC 63 ms 3868 KB
01-N48772M22606 AC 80 ms 3668 KB
01-N60522M40319 AC 93 ms 3824 KB
01-N63340M21398 AC 97 ms 3856 KB
01-N7775M948 AC 19 ms 3632 KB
01-N86918M73878 AC 131 ms 4180 KB
01-N87940M11203 AC 134 ms 4152 KB
01-N95728M66299 AC 142 ms 4216 KB