Submission #201358


Source Code Expand

#include <queue>//priority_queue
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <array>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <vector>
#include <cmath>
#include <bitset>
#include <iostream>

#pragma warning(disable: 4996)

/*-------マクロ定義---------*/

#define nobu_for(i , n) for(L i = 0 ; i < n ; i++)
#define nobu_time(n) nobu_for(i , n)


/*---------Typedef------------*/

//long
typedef long L;
typedef std::pair<L, L>				IntPair;
typedef std::vector<L>				IntVector;
typedef std::priority_queue<L>		IntPriority;
typedef std::queue<L>				IntQueue;
typedef std::stack<L>				IntStack;

//unsigned long
typedef unsigned long ul;
typedef std::pair<ul, ul>			UIntPair;
typedef std::vector<ul>				UIntVector;
typedef std::priority_queue<ul>		UIntPriority;
typedef std::queue<ul>				UIntQueue;
typedef std::stack<ul>				UIntStack;

//double
typedef double D;
typedef std::pair<D, D>				DoublePair;
typedef std::vector<D>				DoubleVector;
typedef std::priority_queue<D>		DoublePriority;
typedef std::queue<D>				DoubleQueue;
typedef std::stack<D>				DoubleStack;

//char
typedef char Ch;
typedef std::pair<Ch, Ch>			CharPair;
typedef std::vector<Ch>				CharVector;
typedef std::priority_queue<Ch>		CharPriority;
typedef std::queue<Ch>				CharQueue;
typedef std::stack<Ch>				CharStack;

//
/*  VectorArray	Dp(1000,IntVector(1000)); */
typedef std::vector<std::vector<L>>		VectorArray;
typedef std::vector<std::vector<ul>>	UVectorArray;
typedef std::vector<std::vector<D>>		DVectorArray;


/*--------ScanOverLoad----------*/

//type long//

void Scan(L& output)
{
	scanf("%ld", &output);
}

void Scan(IntVector& vector)
{
	L scan = 0;
	scanf("%ld", &scan);
	vector.push_back(scan);
}

void Scan(IntPriority& pri_que)
{
	L scan = 0;
	scanf("%ld", &scan);
	pri_que.push(scan);
}

void Scan(IntQueue& que)
{
	L scan = 0;
	scanf("%ld", &scan);
	que.push(scan);
}

void Scan(IntStack& stack)
{
	L scan = 0;
	scanf("%ld",&scan);
	stack.push(scan);
}

//type unsigned long//

void Scan(ul& output)
{
	scanf("%lu", &output);
}

void Scan(UIntVector& vector)
{
	ul scan = 0;
	scanf("%lu", &scan);
	vector.push_back(scan);
}

void Scan(UIntPriority& pri_que)
{
	ul scan = 0;
	scanf("%lu", &scan);
	pri_que.push(scan);
}

void Scan(UIntQueue& que)
{
	ul scan = 0;
	scanf("%lu", &scan);
	que.push(scan);
}

void Scan(UIntStack& stack)
{
	ul scan = 0;
	scanf("%lu", &scan);
	stack.push(scan);
}

//type double//

void Scan(D& output)
{
	scanf("%lf", &output);
}

void Scan(DoubleVector& vector)
{
	D scan = 0;
	scanf("lf", &scan);
	vector.push_back(scan);
}

void Scan(DoublePriority& pri_que)
{
	D scan = 0;
	scanf("%lf", &scan);
	pri_que.push(scan);
}

void Scan(DoubleQueue& que)
{
	D scan = 0;
	scanf("%lf", &scan);
	que.push(scan);
}

void Scan(DoubleStack& stack)
{
	D scan = 0;
	scanf("%lf", &scan);
	stack.push(scan);
}

//type char//

void Scan(Ch& output)
{
	scanf("%c", &output);
}

void Scan(CharVector& vector)
{
	Ch scan = 0;
	scanf("%c", &scan);
	vector.push_back(scan);
}

void Scan(CharPriority& pri_que)
{
	Ch scan = 0;
	scanf("%c", &scan);
	pri_que.push(scan);
}

void Scan(CharQueue& que)
{
	Ch scan = 0;
	scanf("%c", &scan);
	que.push(scan);
}

void Scan(CharStack& stack)
{
	Ch scan = 0;
	scanf("%c", &scan);
	stack.push(scan);
}

/*----------Print----------*/

struct OPrint{
	void operator()(L& value)		{ printf("%ld", value); }
	void operator()(ul& value)		{ printf("%lu", value); }
	void operator()(D& value)		{ printf("%lf", value); }
	void operator()(Ch& value)		{ printf("%c", value); }
};

template<class T>
void Print(T& value){ std::for_each(value.begin(), value.end(), OPrint()); }

void Print(L value){ printf("%ld", value); }

void Print(ul value){ printf("%lu", value); }

void Print(D value){ printf("%lf", value); }

void Print(Ch value){ printf("%c", value); }

/*----------Init---------*/

template<class T>
struct OInit{
	T x;

	OInit(T _x) :x(_x){}

	void operator()(L& value)	{ value = x; }
	void operator()(ul& value)	{ value = x; }
	void operator()(D& value)	{ value = x; }
	void operator()(Ch& value)	{ value = x; }
};

template<class T1 , class T2>
void Init(T1& value,T2 x){ std::for_each(value.begin(), value.end(), OInit<T2>(x)); }

void Init(L& value, L x){ value = x; }

void Init(ul& value, ul x){ value = x; }

void Init(D& value, D x){ value = x; }

void Init(Ch& value, Ch x){ value = x; }


L a, b;

int main()
{
	Scan(a); Scan(b);

	printf("%d %d\n", b, a);

	return 0;
}

Submission Info

Submission Time
Task A - スワップ
User nobu_knellfox
Language C++11 (GCC 4.8.1)
Score 100
Code Size 4734 Byte
Status AC
Exec Time 23 ms
Memory 812 KB

Compile Error

./Main.cpp: In function ‘void Scan(L&)’:
./Main.cpp:70:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%ld", &output);
                       ^
./Main.cpp: In function ‘void Scan(IntVector&)’:
./Main.cpp:76:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%ld", &scan);
                     ^
./Main.cpp: In function ‘void Scan(IntPriority&)’:
./Main.cpp:83:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%ld", &scan);
                     ^
./Main.cpp: In function ‘void Scan(IntQueue&)’:
./Main.cpp:90:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%ld", &scan);
                     ^
./Main.cpp: In function ‘void Sca...

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 6
Set Name Test Cases
All test_13_69.txt, test_16_44.txt, test_40_40.txt, test_49_31.txt, test_51_74.txt, test_83_60.txt
Case Name Status Exec Time Memory
sample_01.txt AC 21 ms 800 KB
sample_02.txt AC 22 ms 812 KB
test_13_69.txt AC 22 ms 736 KB
test_16_44.txt AC 19 ms 800 KB
test_40_40.txt AC 21 ms 804 KB
test_49_31.txt AC 23 ms 796 KB
test_51_74.txt AC 21 ms 800 KB
test_83_60.txt AC 21 ms 800 KB