QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#103322 | #5008. Zero AAMP Currents | joesmitty | WA | 45ms | 4880kb | C++20 | 3.2kb | 2023-05-05 10:43:29 | 2023-05-05 10:43:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef vector<int> vi;
typedef vector< vector <int> > vvi;
typedef pair<int, int> pii;
typedef pair < pair < int, int >, int > piii;
typedef pair < pair <int, int > , pair <int, int> > piiii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
#define FOR(i,a,b) for(int i = a; i < b; i ++)
#define RFOR(i,a,b) for(int i = a-1; i >= b; i --)
#define all(a) a.begin(), a.end()
#define endl '\n';
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
template <typename T>
void pr(vector<T> &v) {
FOR(i, 0, sz(v)) cout << v[i] << " ";
cout << endl;
}
template <typename T>
void pr(vector<vector<T> > &v) {
FOR(i, 0, sz(v)) { pr(v[i]); }
}
template <typename T>
void re(T &x) {
cin >> x;
}
template <typename T>
void re(vector<T> &a) {
FOR(i, 0, sz(a)) re(a[i]);
}
template <class Arg, class... Args>
void re(Arg &first, Args &... rest) {
re(first);
re(rest...);
}
template <typename T>
void pr(T x) {
cout << x << endl;
}
template <class Arg, class... Args>
void pr(const Arg &first, const Args &... rest) {
cout << first << " ";
pr(rest...);
cout << endl;
}
void ps() { cout << endl; }
template<class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
cout << t; if (sizeof...(ts)) cout << " "; ps(ts...);
}
const ll MOD = 1000000007;
#define inf 1e18;
#define INF INT_MAX;
long double PI = 4*atan(1);
long double eps = 1e-12;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//default_random_engine g{1};
int main() {
//auto start = chrono::high_resolution_clock::now();
ios_base::sync_with_stdio(0);cin.tie(0);
// ofstream cout("pieaters.out");
// ifstream cin("pieaters.in");
#ifdef DEBUG
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n,m; cin >> n >> m;
vector<pii> e(m);
vi deg(n);
FOR(i,0,m) {
cin >> e[i].ff >> e[i].ss;
e[i].ff--; e[i].ss--;
deg[e[i].ff]++;
deg[e[i].ss]++;
}
bool good = false;
vi ass(n);
FOR(i,0,n) {
int k = uniform_int_distribution<ll>(0,1000)(rng);
ass[i] = k - 1000;
}
int cnt = 0;
while(!good) {
good = true;
FOR(i,0,m) {
if(ass[e[i].ff] == ass[e[i].ss]) {
good = false;
if(deg[e[i].ff] < deg[e[i].ss]) {
ass[e[i].ff] = uniform_int_distribution<ll>(0,1000)(rng);
} else {
ass[e[i].ss] = uniform_int_distribution<ll>(0,1000)(rng);
}
}
}
cnt ++;
}
// cout << cnt << endl;
FOR(i,0,m) {
cout << ass[e[i].ff] - ass[e[i].ss] << endl;
}
// auto stop = chrono::high_resolution_clock::now();
// auto duration = chrono::duration_cast<chrono::microseconds>(stop - start);
// cout << duration.count() << endl;
//cin.close();
//cout.close();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3432kb
input:
4 7 1 2 2 3 3 1 1 4 2 4 1 4 3 2
output:
218 -334 116 54 -164 54 334
result:
ok good one
Test #2:
score: 0
Accepted
time: 2ms
memory: 3428kb
input:
2 2 1 2 2 1
output:
58 -58
result:
ok good one
Test #3:
score: -100
Wrong Answer
time: 45ms
memory: 4880kb
input:
13758 193861 8665 5619 9734 11588 936 1302 2748 2317 3141 5818 8849 11418 248 943 9907 3274 8337 359 13597 8368 7809 3431 11374 13189 5135 4551 11688 1841 4071 4437 796 364 8000 4384 12954 7759 3399 3585 1918 5592 7368 7392 8872 7186 217 9202 11502 9587 13399 10630 947 3691 1486 8804 8226 7143 2734 ...
output:
248 689 -184 227 -236 -108 -413 -554 122 500 -634 -763 -373 -783 -233 356 -61 -484 167 396 -218 173 -743 -535 -646 -402 -765 -42 543 -60 -618 -786 -768 284 -141 304 487 -399 637 -209 363 -100 -15 246 302 114 -251 775 291 -259 220 -96 -623 566 55 191 160 -23 -101 -377 101 -652 404 -179 -760 -918 343 ...
result:
wrong answer Integer parameter [name=wire current strength] equals to -1733, violates the range [-1000, 1000]