Submission #328994

#TimeUsernameProblemLanguageResultExecution timeMemory
328994TraduttoreRed-blue table (IZhO19_stones)C++14
0 / 100
43 ms1516 KiB
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/detail/standard_policies.hpp> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define F first #define S second #define ld long double #define ll long long #define endl '\n' #define pll pair <ll,ll> #define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define TIME 1.0*clock()/CLOCKS_PER_SEC using namespace std; using namespace __gnu_pbds; mt19937_64 gen(time(NULL)); typedef tree <ll,null_type,less <ll>,rb_tree_tag,tree_order_statistics_node_update> orduk; typedef tree <pll,null_type,less <pll>,rb_tree_tag,tree_order_statistics_node_update> orduk2; //typedenf tree <vector <orduk2>,null_type,less <>,rb_tree_tag,tree_order_statistics_node_update> orduk2; ll t; ll n,m; void init() { cin>>t; } vector <vector <char> > a; ll ans = 0; void output() { cout<<ans<<'\n'; for (int i = 0;i < n;i++) { for (int j = 0;j < m;j++) { cout<<a[i][j]; } cout<<'\n'; } } void solve() { while (t--) { cin>>n>>m; a.clear(); a.resize(n,vector <char> (m)); int p1 = -1; int p2 = -1; for (int i = 0;i < n;i++) { for (int j = 0;j < m;j++) { a[i][j] = '+'; } } vector <int> kol(m); ans = n; ll vz = 0; for (int i = 0;i < n;i++) { for (int j = 0;j < m;j++) { ll cur = n - i - (j >= (m / 2)); ++kol[j]; if (kol[j] == (n / 2) + 1) ++vz; cur+=vz; ans = max(ans,cur); if (ans==cur) p1 = i,p2 = j; } } for (int i = 0;i <= p1;i++) { for (int j = 0;j < m;j++) { if (i!=p1) a[i][j] = '-'; else if (i==p1 && j <= p2) a[i][j] = '-'; } } output(); } exit(0); } int main() { //freopen("repair.in","r",stdin); //freopen("repair.out","w",stdout); IOS; srand(time(NULL)); ll m; m = 10; m-=9; while (m--) { init(); solve(); output(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...