测代码时空
xAlec
·
·
算法·理论
#include <bits/stdc++.h>
#define int long long
using namespace std;
bool st; //
int a, b;
int arr[114514];
vector<int> vec;
set<int> s;
priority_queue<int> q;
map<int,int> mapp;
pair<int,int> pr[114514];
bool ed; // 用两个 bool 类型变量框住所有定义的东西(只能测定义变量的空间)
signed main() {
clock_t s = clock();
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> a >> b;
cout << a + b << '\n';
// 在所有答案输出之后(干脆就 return 0 之前再测一次时间)
clock_t t = clock();
cout << fixed << setprecision(3) << 1.0 * (t - s) / CLOCKS_PER_SEC << "秒" << '\n'; // 记得一定是除以 CLOCKS_PER_SEC
// 测时间
cout << 1.0 * (&ed - &st) / 1024 / 1024 << "MB" <<'\n';
// 测空间
return 0;
} // 这个方法测时间一定是用文件读入才能测准
// 111