# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154330 | dandrozavr | Chessboard (IZhO18_chessboard) | C++14 | 700 ms | 1072 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fi first
#define se second
#define ld long double
#define pi 3.1415926535897932384626433832795
#define sz(a) (int)a.size()
#define pii pair < int , int >
#define IOS {ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);}
#define TIME 1.0*clock()/CLOCKS_PER_SEC
#define pb push_back
using namespace std;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
const int tinf = (int)1e9 + 7;
const long long inf = (long long)1e18 + 7;
const int N = 2e5 + 5;
const int M = 1e9 + 7;
int a[505][505];
namespace fastio {
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<class T1, class T2> ostream& operator << (ostream& os, const pair<T1, T2>& p) { return os << p.first << " " << p.second; }
template <class T> ostream &operator<<(ostream &os, set<T> const& con) { for (auto &u : con) os << u << " "; return os; }
void pr() {}
template <typename T, typename... args> void pr(T x, args... tail) { cout << x << " "; pr(tail...);}
}
using namespace fastio;
signed main(){
freopen("input.txt", "w", stdout);
int n = gen() % 400 + 50;
cout << n << " ";
vector < pair < pii , pii > > all;
int k = 200;
for (int i = 0; i < k; ++i)
{
while(clock() <= 0.7 * CLOCKS_PER_SEC)
{
int x1 = gen() % n ;
int x2 = gen() % n ;
if (x1 > x2)
swap(x1, x2);
int y1 = gen() % n;
int y2 = gen() % n;
if (y1 > y2)
swap(y1, y2);
bool g = 1;
for (int i = x1; i <= x2; ++i)
for (int j = y1; j <= y2; ++j)
if (a[i][j])
{
g = 0;
break;
}
if (g)
{
all.pb({{x1, y1}, {x2, y2}});
break;
}
}
if (all.size())
{
auto la = all.back();
for (int i = la.fi.fi; i <= la.se.fi; ++i)
for (int j = la.fi.se; j <= la.se.se; ++j)
a[i][j] = 1;
}
}
cout << all.size()<<endl;
for (auto i : all)
cout<<i.fi.fi+1<<" "<<i.fi.se+1<<" "<<i.se.fi+1<<" "<<i.se.se+1<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |