输入两个整数,求这两个整数的和是多少。
输入格式
输入两个整数A,B,用空格隔开
输出格式
输出一个整数,表示这两个数的和
数据范围
0≤A,B≤108
样例输入:
3 4
样例输出:
7
难度:$\Huge\Huge\Huge\Huge\Huge\Huge\Huge\Huge\Huge\Huge\Huge\color{wine}{变态}$
时/空限制:$\color{red}{1ms}$ / $\color{red}{1MB}$
总通过数:0
总尝试数:133857
来源:不明
算法标签:模拟
正经且错误的C++代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
cout<<n+m<<endl;
return 0;
}
不正经却任然错误的C++代码
#pragma GCC diagnostic error "-std=c++11"
#pragma GCC target("avx")
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include<bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <csignal>
#include <csetjmp>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <bits/c++config.h>
#include <bits/functexcept.h>
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
#include <ext/numeric_traits.h>
#include <bits/stl_pair.h>
#include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#include <bits/stl_iterator.h>
#include <bits/concept_check.h>
#include <debug/debug.h>
#include <bits/move.h>
using namespace std;
#define set(x) Set(x)
#define REP(i,j,k) for (int i=(j),_end_=(k);i<=_end_;++i)
#define DREP(i,j,k) for (int i=(j),_start_=(k);i>=_start_;--i)
#define mp make_pair
#define x first
#define y second
#define pb push_back
template<typename T> inline bool chkmin(T &a,const T &b){ return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a,const T &b){ return a < b ? a = b, 1 : 0; }
typedef long long LL;
typedef pair<int,int> node;
const int dmax = 1010, oo = 0x3f3f3f3f;
int n, m;
int v[10086];
int a[dmax][dmax] , ans;
int d[dmax], e[dmax];
priority_queue <node> q;
inline bool operator >(node a,node b){ return a.y>b.y; }
bool p[dmax];
void Set(int x){ p[x] = 1; }
void unset(int x){ p[x] = 0; }
bool check(int x){ return x != 1 && x != n && !p[x] && e[x] > 0; }
void preflow(){
e[1] = oo;
d[1] = n - 1;
q.push(mp(1, n - 1));
set(1);
while (!q.empty()) {
bool flag = 1;
int k = q.top().x;
q.pop(), unset(k);
DREP(i, n, 1)
if ((d[k] == d[i] + 1 || k == 1) && a[k][i] > 0){
flag = 0;
int t = min(a[k][i], e[k]);
e[k] -= t;
a[k][i] -= t;
e[i] += t;
a[i][k] += t;
if (check(i)) {
q.push(mp(i, d[i]));
set(i);
}
if (e[k] == 0) break;
}
if (flag) {
d[k] = oo;
REP(i, 1, n)
if (a[k][i] > 0) chkmin(d[k], d[i] + 1);
}
if (check(k)) {
q.push(mp(k, d[k]));
set(k);
}
}
ans = e[n];
}
int check() {
for (int i = 1;i < n; i++) if(v[i] > v[i + 1]) return 0;
return 1;
}
int main() {
n = 2, m = 2;
int x, y;
scanf("%d%d", &x, &y);
v[0]=x;
v[1]=y;
while (1) {
random_shuffle(v + 1, v + 1 + n);
if(check()) break;
}
a[1][2] += x + y;
preflow();
printf("%d\n", ans);
return 0;
}
我O3都没法1ms
所有方法我都试过了……
不过貌似网络流比普通A+B还快……是吗确实呀,我试过了大睿智啊对对对,我是大弱智你猜对了
快读快输
写高精!!
我*
首先,namespace可以去掉;其次,O2优化忘了吗?
有道理
不过洛谷上貌似还是3ms