前言
上次测评,还是在上次。
本次,我们又邀请了新的 2 名选手,共 15 名。有请它们出场:
| 编号 | 简介 |
|---|
| 1 | 普通 cin,cout |
| 2 | 普通 scanf,printf |
| 3 | 解绑 cin,cout |
| 4 | cin.tie(0),cout.tie(0) |
| 5 | 解绑+tie(0) |
| 6 | 普通快读 |
| 7 | 位运算优化快读 |
| 8 | inline 优化快读 |
| 9 | fread,fwrite |
| 10 | buf 读 string |
| 11 | mmap(洛谷上可用) |
| 12 | unlocked()(洛谷上可用) |
| 13 | fread 读 char 数组(上次那个“同学做的 IO”) |
| 14 | c++自带的 read |
| 15 | streambuf 读 char 数组(上次那个“同学声称超级快的快读”) |
这次我依然自己制作了题目,为了省空间只造了一个测试点。
题目链接
依旧是经典的 5s 和 512MB,每人 3 次机会。
下面给出每名选手的代码。
代码
1 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int main(){
cin>>n;
for(int i=1,x;i<=n;i++){
cin>>x;
ans^=x;
}
cout<<ans<<endl;
return 0;
}
2 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int main(){
scanf("%d",&n);
for(int i=1,x;i<=n;i++){
scanf("%d",&x);
ans^=x;
}
printf("%d\n",ans);
return 0;
}
3号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int main(){
ios::sync_with_stdio(0);
cin>>n;
for(int i=1,x;i<=n;i++){
cin>>x;
ans^=x;
}
cout<<ans<<endl;
return 0;
}
4号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int main(){
cin.tie(0),cout.tie(0);
cin>>n;
for(int i=1,x;i<=n;i++){
cin>>x;
ans^=x;
}
cout<<ans<<endl;
return 0;
}
5 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n;
for(int i=1,x;i<=n;i++){
cin>>x;
ans^=x;
}
cout<<ans<<endl;
return 0;
}
6 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int read(){
int k=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9') k=k*10+c-'0',c=getchar();
return k*f;
}
int main(){
n=read();
for(int i=1,x;i<=n;i++){
x=read();
ans^=x;
}
cout<<ans<<endl;
return 0;
}
7 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int read(){
int x=0,f=1;
char ch=getchar();
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return x*f;
}
int main(){
n=read();
for(int i=1,x;i<=n;i++){
x=read();
ans^=x;
}
cout<<ans<<endl;
return 0;
}
8 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
inline int read(){
int x=0,f=1;
char ch=getchar();
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
int main(){
n=read();
for(int i=1,x;i<=n;i++){
x=read();
ans^=x;
}
cout<<ans<<endl;
return 0;
}
9 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
const int BUFSIZE=1<<20;
char ibuf[BUFSIZE],*is=ibuf,*it=ibuf;
inline char getch(){if(is==it)it=(is=ibuf)+fread(ibuf,1,BUFSIZE,stdin);return is==it?EOF:*is++;}
char tmp[BUFSIZE];int cnt=0;
int read(){
int x=0,f=1;
char ch=getch();
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getch();
}
while(isdigit(ch)){
x=x*10+ch-'0';
ch=getch();
}
return x*f;
}
int main(){
n=read();
for(int i=1,x;i<=n;i++){
x=read();
ans^=x;
}
cout<<ans<<endl;
return 0;
}
10 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
namespace Fast_I{
char *_Buf,*_Start_ptr,*_End_ptr;
streambuf *inbuf;
unsigned int Size;
bool _Ok;
struct Fast_Istream{
operator bool(){return _Ok;}
Fast_Istream(streambuf *in,unsigned int Sz){
_Ok=1;
Fast_I::Size=Sz;
inbuf=in;
_Start_ptr=_End_ptr=_Buf=new char[Sz];
}
Fast_Istream(const char *in,unsigned int Sz){
_Ok=1;
Fast_I::Size=Sz;
rdbuf(in);
_Start_ptr=_End_ptr=_Buf=new char[Sz];
}
Fast_Istream(unsigned int Sz){
_Ok=1;
Fast_I::Size=Sz;
_Start_ptr=_End_ptr=_Buf=new char[Sz];
}
void rdbuf(const char *File){
static ifstream __In__(File);
rdbuf(__In__.rdbuf());
}
void Get_Char(char &_Val){
if(_Start_ptr==_End_ptr){
_Start_ptr=_Buf;
_End_ptr=_Buf+inbuf->sgetn(_Buf,Size);
}
if(_Start_ptr==_End_ptr){
_Val=-1;
_Ok=0;
}else _Val=*_Start_ptr++;
}
Fast_Istream &operator>>(char &_Val){
if(_Ok){
Get_Char(_Val);
while(_Val==32||_Val==10||_Val==13||_Val==8||_Val==9||_Val==7||_Val==12||_Val==11) Get_Char(_Val);
}
return *this;
}
Fast_Istream &operator>>(char *_Val){
if(_Ok){
Get_Char(*_Val);
while(*_Val==32||*_Val==10||*_Val==13||*_Val==8||*_Val==9||*_Val==7||*_Val==12||*_Val==11) Get_Char(*_Val);
while(*_Val!=32&&*_Val!=10&&*_Val&&*_Val!=-1&&*_Val!=9 &&*_Val!=11&&*_Val!=12&&~*_Val) Get_Char(*++_Val);
*_Val=0;
--_Start_ptr;
}
return *this;
}
Fast_Istream &operator>>(string &_Val){
if(_Ok){
char c;
Get_Char(c);
while(c==32||c==10||c==13||c==8||c==9||c==7||c==12||c==11) Get_Char(c);
for(_Val.clear();c!=32&&c!=10&&c&&c!=-1&&c!=9&&c!=11&&c!=12&&~c;Get_Char(c)) _Val.push_back(c);
--_Start_ptr;
}
return *this;
}
template <typename Typex>
void Get_Int(Typex &_Val){
if(_Ok){
char ch;
bool _F=0;
for(Get_Char(ch);(ch<48||ch>57)&&~ch;Get_Char(ch)) _F=ch==45;
for(_Val=0;ch>47&&ch<58&&~ch;Get_Char(ch)) _Val=_Val*10+(ch^48);
if(_F) _Val=~_Val+1;
--_Start_ptr;
}
}
template <typename Typex>
void Get_Unsigned(Typex &_Val){
if(_Ok){
char ch;
Get_Char(ch);
while((ch<48||ch>57)&&~ch) Get_Char(ch);
for(_Val=0;ch>47&&ch<58&&~ch;Get_Char(ch)) _Val=_Val*10+(ch^48);
--_Start_ptr;
}
}
template <typename Typex>
void Get_Double(Typex &_Val){
if(_Ok){
char ch;
bool _F=0;
for(Get_Char(ch);(ch<48||ch>57)&&~ch;Get_Char(ch)) _F=ch==45;
for(_Val=0;ch>47&&ch<58&&~ch;Get_Char(ch)) _Val=_Val*10+(ch^48);
if(ch==46){
unsigned long long _Pow=1;
for(Get_Char(ch);ch>47&&ch<58&&~ch;Get_Char(ch)) _Val+=Typex((ch^48)*1.0/(_Pow*=10));
}
if(_F) _Val=-_Val;
--_Start_ptr;
}
}
Fast_Istream &operator>>(bool &_Val){
if(_Ok){
char ch;
Get_Char(ch);
while(ch==32||ch==10||ch==13||ch==8||ch==9||ch==7||ch==12||ch==11) Get_Char(ch);
while(ch!=32&&ch!=10&&ch&&~ch&&ch!=9&&ch!=11&&ch!=12&&~ch){
_Val|=ch!=48;
Get_Char(ch);
}
--_Start_ptr;
}
return *this;
}
Fast_Istream &operator>>(short &_Val){
Get_Int(_Val);
return *this;
}
Fast_Istream &operator>>(int &_Val){
Get_Int(_Val);
return *this;
}
Fast_Istream &operator>>(long &_Val){
Get_Int(_Val);
return *this;
}
Fast_Istream &operator>>(long long &_Val){
Get_Int(_Val);
return *this;
}
Fast_Istream &operator>>(unsigned short &_Val){
Get_Unsigned(_Val);
return *this;
}
Fast_Istream &operator>>(unsigned int &_Val){
Get_Unsigned(_Val);
return *this;
}
Fast_Istream &operator>>(unsigned long &_Val){
Get_Unsigned(_Val);
return *this;
}
Fast_Istream &operator>>(unsigned long long &_Val){
Get_Unsigned(_Val);
return *this;
}
Fast_Istream &operator>>(float &_Val){
Get_Double(_Val);
return *this;
}
Fast_Istream &operator>>(double &_Val){
Get_Double(_Val);
return *this;
}
Fast_Istream &operator>>(long double &_Val){
Get_Double(_Val);
return *this;
}
template <typename Typex,typename... More>
void operator()(Typex &_Val,More &... _More){
*this>>_Val;
operator()(_More...);
}
void pop(){
char ch;
Get_Char(ch);
}
char peek(){
if(_Start_ptr==_End_ptr){
_Start_ptr=_Buf;
_End_ptr=_Buf+inbuf->sgetn(_Buf,Size);
}
if(_Start_ptr==_End_ptr){
_Ok=0;
return -1;
}else return *_Start_ptr;
}
template <typename Typex>
void operator()(Typex &_Val){*this>>_Val;}
template <typename Typex,typename...More>
streambuf *rdbuf(){return inbuf;}
void rdbuf(streambuf *_inbuf){inbuf=_inbuf;}
Fast_Istream getline(string &s,char _End='\n'){
if(_Ok){
char c;
Get_Char(c);
while((c==32||c==10||c==13||c==8||c==9||c==7||c==12||c==11||c==-1)&&c!=_End) Get_Char(c);
for(s.clear();c!=_End&&~c;Get_Char(c)) s.push_back(c);
--_Start_ptr;
}
return *this;
}
};
}
//快写
namespace Fast_O{
string buf;
streambuf *outbuf;
int _M_precision=6;
struct Fast_Ostream{
Fast_Ostream(streambuf *out,unsigned int Size){
buf.reserve(Size);
outbuf=out;
}
Fast_Ostream(std::streambuf* out){outbuf=out;}
Fast_Ostream(const char *File,unsigned int Size){
buf.reserve(Size);
rdbuf(File);
}
void rdbuf(const char *File){
static ofstream __Out__(File);
rdbuf(__Out__.rdbuf());
}
Fast_Ostream(unsigned int Size){buf.reserve(Size);}
void flush(){
outbuf->sputn(buf.data(),buf.size());
buf.clear();
}
~Fast_Ostream(){flush();}
void endl(){buf.push_back('\n');}
Fast_Ostream &operator<<(char _Val){
buf.push_back(_Val);
return *this;
}
Fast_Ostream &operator<<(const char *_Val){
while(*_Val) buf.push_back(*_Val++);
return *this;
}
Fast_Ostream &operator<<(const string &_Val){
buf+=_Val;
return *this;
}
template <typename Typex>
void Put_Unsigned(Typex _Val){
char *_Stack=(char *)malloc(sizeof(Typex)*3);
unsigned S_top=0;
while(_Val){
_Stack[++S_top]=(_Val%10)^48;
_Val/=10;
}
if(!S_top) buf.push_back('0');
while(S_top) buf.push_back(_Stack[S_top--]);
free(_Stack);
}
template <typename Typex>
void Put_Int(Typex _Val){
if(_Val<0){
buf.push_back('-');
Put_Unsigned(~_Val+1);
}else Put_Unsigned(_Val);
}
Fast_Ostream &operator<<(bool _Val){
buf.push_back(_Val?'1':'0');
return *this;
}
Fast_Ostream &operator<<(short _Val){
Put_Int(_Val);
return *this;
}
Fast_Ostream &operator<<(int _Val){
Put_Int(_Val);
return *this;
}
Fast_Ostream &operator<<(long _Val){
Put_Int(_Val);
return *this;
}
Fast_Ostream &operator<<(long long _Val){
Put_Int(_Val);
return *this;
}
Fast_Ostream &operator<<(unsigned short _Val){
Put_Unsigned(_Val);
return *this;
}
Fast_Ostream &operator<<(unsigned int _Val){
Put_Unsigned(_Val);
return *this;
}
Fast_Ostream &operator<<(unsigned long _Val){
Put_Unsigned(_Val);
return *this;
}
Fast_Ostream &operator<<(unsigned long long _Val){
Put_Unsigned(_Val);
return *this;
}
template <typename Typex>
void endl(const Typex &_Val){*this<<_Val<<'\n';}
template <typename Typex,typename... More>
void endl(const Typex &_Val,const More &... _More){
*this<<_Val;
endl(_More...);
}
template <typename Typex>
void operator()(const Typex &_Val){*this<<_Val;}
template <typename Typex,typename... More>
void operator()(const Typex &_Val,const More &... _More){
*this<<_Val;
operator()(_More...);
}
std::streambuf *rdbuf(){return outbuf;}
void rdbuf(std::streambuf *_outbuf){outbuf=_outbuf;}
};
}
namespace Fast_IO{
Fast_I::Fast_Istream fin(cin.rdbuf(),16777216);
Fast_O::Fast_Ostream fout(cout.rdbuf());
}
using namespace Fast_IO;
int main(){
fin>>n;
for(int i=1,x;i<=n;i++){
fin>>x;
ans^=x;
}
fout<<ans<<'\n';
return 0;
}
11 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
char *pc;
int rd(){
int x=0,f=1;
char c=*pc++;
while(!isdigit(c)){
if(c=='-') f=-1;
c=*pc++;
}
while(isdigit(c)) x=x*10+c-'0',c=*pc++;
return x*f;
}
int main(){
int fd=0;
struct stat state;
fstat(fd,&state);
pc=(char*)mmap(NULL,state.st_size,PROT_READ,MAP_PRIVATE,fd,0);
close(fd);
n=rd();
for(int i=1,x;i<=n;i++){
x=rd();
ans^=x;
}
cout<<ans<<endl;
return 0;
}
12 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
int read(){
int num=0,f=1;char c=getchar_unlocked();
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar_unlocked();}
while(c>='0'&&c<='9'){num=num*10+(c-'0');c=getchar_unlocked();}
return num*f;
}
int main(){
n=read();
for(int i=1,x;i<=n;i++){
x=read();
ans^=x;
}
cout<<ans<<endl;
return 0;
}
13 号选手
C++#include<bits/stdc++.h>
using namespace std;
int n;
int ans;
#define MAXSIZE (1<<20)
#define isdigit(x) ( x >= '0' && x <= '9' )
#define blank(x) ( x == ' ' || x == '\n' || x == '\r' || x == '\t' )
#define Setprecision 6
namespace Fread {
char buf[MAXSIZE] ,*p1,*p2 ;//输入缓冲区优化(Fread命名空间)
inline char getchar () { if (p1 == p2) p2 = (p1 = buf) + fread(buf , 1 , MAXSIZE , stdin) ; return p1 == p2 ? '\n' : *p1++ ; }//定义getchar()
}
namespace Fwrite {//输出缓冲区优化(Fwrite命名空间)
char buf[MAXSIZE],*p1 = buf , *p2 = buf + MAXSIZE ;
inline void flush () { fwrite(buf, 1, p1 - buf, stdout); p1 = buf; }
inline void putchar (char c) { *p1++ = c; if (p1 == p2) flush(); }//定义putchar()
struct NTR { ~NTR() { flush(); } } ztr;// 程序结束时自动刷新
}
using namespace Fread ;
using namespace Fwrite ;
#define getchar Fread::getchar
#define putchar Fwrite::putchar
namespace IO
{
struct Reader //Reader类(重载>>运算符)
{
template <typename T> Reader& operator >> (T &x) //int ,long long ,long ,__int128
{
x = 0 ; short f = 1 ;char c = getchar() ;
while ( !isdigit(c) ) {if (c == '-') { f = -1 ; } c = getchar() ; }
while ( isdigit(c) ) x = (x << 3) + (x << 1) + (c ^ 48) , c = getchar() ;
x *= f ;
return *this ;
}
Reader& operator >> (double &x)//double
{
x = 0 ; double t = 0 ; short f = 1 , s = 0 ; char c = getchar() ;
while ( (!isdigit(c)) && c != '.' ) {if (c == '-') { f = -1 ; } c = getchar() ; }
while ( (isdigit(c)) && c != '.' ) x = (x * 10) + (c ^ 48) , c = getchar() ;
if (c == '.') c = getchar() ;
else { x *= f ; return *this ; }
while (isdigit(c)) t = t * 10 + (c ^ 48) , s++ , c = getchar() ;
while (s--) t /= 10.0 ;
x = (x + t) * f ;
return *this ;
}
Reader& operator >> (long double &x)//long double
{
x = 0 ; long double t = 0 ; short f = 1 , s = 0 ; char c = getchar() ;
while ( (!isdigit(c)) && c != '.') { if (c == '-') { f = -1 ; } c = getchar() ; }
while ( (isdigit(c)) && c != '.' ) x = (x * 10) + (c ^ 48) , c = getchar() ;
if (c == '.') c = getchar() ;
else { x *= f ; return *this ; }
while (isdigit(c)) t = t * 10 + (c ^ 48) , s++ , c = getchar() ;
while (s--) t /= 10.0 ;
x = (x + t) * f ;
return *this ;
}
Reader& operator >> (__float128 &x)//__float128
{
x = 0 ; __float128 t = 0 ; short f = 1 , s = 0 ; char c = getchar() ;
while ( (!isdigit(c)) && c != '.') { if (c == '-') { f = -1 ; } c = getchar() ; }
while ( (isdigit(c)) && c != '.' ) x = (x * 10) + (c ^ 48) , c = getchar() ;
if (c == '.') c = getchar() ;
else { x *= f ; return *this ; }
while (isdigit(c)) t = t * 10 + (c ^ 48) , s++ , c = getchar() ;
while (s--) t /= 10.0 ;
x = (x + t) * f ;
return *this ;
}
Reader& operator >> (char &c)//char
{
c = getchar() ;
while ( blank(c) ) c = getchar() ;
return *this ;
}
Reader& operator >> (char *str)//char[]
{
int len = 0;
char c = getchar() ;
while ( blank(c) ) c = getchar() ;
while ( !blank(c) ) str[len++] = c , c = getchar() ;
str[len] = '\0' ;
return *this ;
}
Reader& operator >> (string &str)//string
{
str.clear() ;
char c = getchar() ;
while ( blank(c) ) c = getchar() ;
while ( !blank(c) ) str.push_back(c) , c = getchar() ;
return *this ;
}
Reader() {}
}cin;
const char endl = '\n' ;//endl -> '\n'
struct Writer//Writer类(重载<<运算符)
{
typedef int mxdouble ;
template <typename T> Writer& operator << (T x)//int ,long long ,long ,__int128
{
if (x == 0) { putchar('0') ; return *this; }
if (x < 0) putchar('-') , x = -x ;
static short sta[40] ;
short top = 0 ;
while (x > 0) sta[++top] = x % 10 , x /= 10 ;
while (top > 0) putchar(sta[top] + '0') , top-- ;
return *this ;
}
Writer& operator << (double x)//double
{
if (x < 0) putchar('-') , x = -x ;
mxdouble _ = x;
x -= (double)_;
static short sta[40] ;
short top = 0 ;
while (_ > 0) sta[++top] = _ % 10 , _ /= 10 ;
if (top == 0) putchar('0') ;
while (top > 0) putchar(sta[top] + '0'), top-- ;
putchar('.') ;
for (int i = 0 ; i < Setprecision; i++) x *= 10 ;
_ = x;
while (_ > 0) sta[++top] = _ % 10 , _ /= 10 ;
for (int i = 0 ; i < Setprecision - top ; i++) putchar('0') ;
while (top > 0) putchar(sta[top] + '0') , top-- ;
return *this ;
}
Writer& operator << (long double x)//long double
{
if (x < 0) putchar('-') , x = -x ;
mxdouble _ = x ;
x -= (long double)_ ;
static short sta[40] ;
short top = 0 ;
while (_ > 0) sta[++top] = _ % 10 , _ /= 10 ;
if (top == 0) putchar('0') ;
while (top > 0) putchar(sta[top] + '0') , top-- ;
putchar('.');
for (int i = 0 ; i < Setprecision ; i++) x *= 10 ;
_ = x ;
while (_ > 0) sta[++top] = _ % 10 , _ /= 10 ;
for (int i = 0 ; i < Setprecision - top ; i++) putchar('0') ;
while (top > 0) putchar(sta[top] + '0') , top-- ;
return *this ;
}
Writer& operator << (__float128 x)//__float128
{
if (x < 0) putchar('-') , x = -x ;
mxdouble _ = x ;
x -= (__float128)_ ;
static short sta[40] ;
short top = 0;
while (_ > 0) sta[++top] = _ % 10 , _ /= 10 ;
if (top == 0) putchar('0') ;
while (top > 0) putchar(sta[top] + '0'), top-- ;
putchar('.') ;
for (int i = 0 ; i < Setprecision ; i++) x *= 10 ;
_ = x;
while (_ > 0) sta[++top] = _ % 10 , _ /= 10 ;
for (int i = 0 ; i < Setprecision - top; i++) putchar('0') ;
while (top > 0) putchar(sta[top] + '0') , top-- ;
return *this ;
}
Writer& operator << (char c) { putchar(c) ; return *this ; }//char
Writer& operator << (char *str)//char[]
{
int cur = 0 ;
while (str[cur]) putchar(str[cur++]) ;
return *this ;
}
Writer& operator << (const char *str)
{
int cur = 0 ;
while (str[cur]) putchar(str[cur++]) ;
return *this ;
}
Writer& operator << (string str)//string
{
int st = 0, ed = str.size() ;
while (st < ed) putchar(str[st++]) ;
return *this ;
}
Writer() {}
}cout;
}
using namespace IO;
#define cin IO::cin
#define cout IO::cout
#define endl IO::endl
int main(){
cin>>n;
for(int i=1,x;i<=n;i++){
cin>>x;
ans^=x;
}
cout<<ans<<endl;
return 0;
}
14 号选手
C++#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
int n;
int ans;
char buffer[32769];
unsigned li=0;
int fastread(){
char ch;
do{
read(0,&ch,1);
} while(ch==' '||ch=='\n');
int flag=(ch!='-'?1:(read(0, &ch, 1)*0+-1));
int a=0;
do{
a=a*10+ch-'0';
read(0,&ch,1);
}while(ch>='0'&&ch<='9');
return a*flag;
}
int main(){
n=fastread();
for(int i=1,x;i<=n;i++){
x=fastread();
ans^=x;
}
cout<<ans<<endl;
return 0;
}
15 号选手
C++#include<bits/stdc++.h>
#define ull unsigned long long
using namespace std;
namespace Fast_I{
char *_Buf,*_Start_ptr,*_End_ptr,ch;
streambuf *inbuf;
constexpr unsigned int Size=1<<18;
bool _F;
struct Fast_Istream{
Fast_Istream(streambuf *in){
inbuf=in;
_Start_ptr=_End_ptr=_Buf=new char[Size];
}
void Get_Char(char &_Val){
if(__builtin_expect(_Start_ptr==_End_ptr,0)){
_Start_ptr=_Buf;
_End_ptr=_Buf+inbuf->sgetn(_Buf,Size);
if(__builtin_expect(_Start_ptr==_End_ptr,0)){
_Val=-1;
return;
}
}
_Val=*_Start_ptr++;
}
void Get_Unsigned(ull &_Val){
Get_Char(ch);
for(_Val=0;ch>47&&ch<58;Get_Char(ch)){
_Val=_Val*10+(ch^48);
}
}
Fast_Istream &operator>>(ull &_Val){
Get_Unsigned(_Val);
return *this;
}
void GetN(ull &_Val){
Get_Unsigned(_Val);
_Start_ptr++;
}
};
}// namespace Fast_I
//快写
namespace Fast_O{
string buf;
streambuf *outbuf;
char _Stack[13];
unsigned S_top;
struct Fast_Ostream{
Fast_Ostream(std::streambuf* out){
outbuf=out;
}
void flush(){
outbuf->sputn(buf.data(),buf.size());
buf.clear();
}
~Fast_Ostream(){
flush();
}
void Put_Unsigned(ull _Val){
S_top=0;
while(_Val){
_Stack[++S_top]=(_Val%10)^48;
_Val/=10;
}
if(!S_top){
buf+='0';
}
while(S_top){
buf+=_Stack[S_top--];
}
}
Fast_Ostream &operator<<(ull _Val){
Put_Unsigned(_Val);
return *this;
}
};
}
namespace Fast_IO{
Fast_I::Fast_Istream fin(cin.rdbuf());
Fast_O::Fast_Ostream fout(cout.rdbuf());
}
#define fin Fast_IO::fin
#define fout Fast_IO::fout
ull s,n,a;
int main(){
fin.GetN(n);
for(int i=1;i<=n;i++){
fin>>a;
s^=a;
}
fout<<s;
return 0;
}
测试
1 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 2970 |
| 2 | 2960 |
| 3 | 2960 |
2 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 1060 |
| 2 | 1050 |
| 3 | 1050 |
3 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 890 |
| 2 | 887 |
| 3 | 912 |
4 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 2870 |
| 2 | 2880 |
| 3 | 2880 |
5 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 837 |
| 2 | 830 |
| 3 | 855 |
6 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 343 |
| 2 | 343 |
| 3 | 344 |
7 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 338 |
| 2 | 338 |
| 3 | 339 |
8 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 307 |
| 2 | 309 |
| 3 | 306 |
9 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 130 |
| 2 | 130 |
| 3 | 130 |
10 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 164 |
| 2 | 163 |
| 3 | 163 |
11 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 91 |
| 2 | 90 |
| 3 | 92 |
12 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 156 |
| 2 | 155 |
| 3 | 157 |
13 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 115 |
| 2 | 113 |
| 3 | 115 |
14 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | TLE |
| 2 | TLE |
| 3 | TLE |
15 号选手
| 测试编号 | 总用时(ms) |
|---|
| 1 | 116 |
| 2 | 116 |
| 3 | 117 |
结算
| Rank | Name | Time(ms) |
|---|
| 1 | mmap | 91 |
| 2 | fread 读 char 数组 | 114 |
| 3 | streambuf 读 char 数组 | 116 |
| 4 | fread,fwrite | 130 |
| 5 | unlocked() | 156 |
| 6 | buf 读 string | 163 |
| 7 | inline 优化快读 | 307 |
| 8 | 位运算优化快读 | 338 |
| 9 | 普通快读 | 343 |
| 10 | 解绑+tie(0) | 840 |
| 11 | 解绑 cin,cout | 896 |
| 12 | 普通 scanf,printf | 1053 |
| 13 | tie(0) | 2873 |
| 14 | 普通 cin,cout | 2963 |
| 15 | C++自带的 read | TLE |
mmap 牛逼!mmap 好闪,拜谢 mmap
- 前几名稳定发挥,没什么好说的
- 快读家族排到一起了?
- 解绑+
tie(0) 依然性价比很高
- 最后一名认真的?
我们每 5 名一分组:(最后一名算 5s)
| 组别 | 平均用时(ms) |
|---|
| A | 121 |
| B | 398 |
| C | 2557 |
感谢你的观看!(下面依旧有隐藏字!)
总是有人问我,哎呀CEXE
你为什么总是出毒瘤模拟赛?那我问你:
我不出模拟赛我会不会没事干?
我们不做模拟赛会不会保龄?
回答我!
Lookinmyeyes!
Tellme!
Whywhybabywhy
没事干会不会就去颓?
嗯?
你回答我