Submission #992793

#TimeUsernameProblemLanguageResultExecution timeMemory
992793Ice_manRed-blue table (IZhO19_stones)C++14
100 / 100
20 ms2396 KiB
/** ____ ____ ____ __________________ ____ ____ ____ ||I || ||c || ||e || || || ||M || ||a || ||n || ||__|| ||__|| ||__|| ||________________|| ||__|| ||__|| ||__|| |/__\| |/__\| |/__\| |/________________\| |/__\| |/__\| |/__\| */ #include <iostream> #include <chrono> #include <stack> #include <vector> #define endl '\n' #define maxn 1000005 #define maxlog 20 #define INF 1000000010 #define LINF 1000000000000000005 #define endl '\n' #define pb(x) push_back(x) #define X first #define Y second #define control cout<<"passed"<<endl; #pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math") #pragma GCC target("avx2") using namespace std; typedef pair <int, int> pii; typedef long long ll; typedef pair <ll, ll> pll; typedef pair <int, ll> pil; typedef pair <ll, int> pli; typedef long double ld; std::chrono::high_resolution_clock::time_point startT, currT; constexpr double TIME_MULT = 1; double timePassed() { using namespace std::chrono; currT = high_resolution_clock::now(); double time = duration_cast<duration<double>>(currT - startT).count(); return time * TIME_MULT; } int n, m; int br; void read_solve() { cin >> n >> m; vector <vector <char>> v; bool lamp = false; if(m > n) { swap(n, m); lamp = true; } v.resize(n + 1); for(int i = 1; i <= n; i++) v[i].resize(m + 1); for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) v[i][j] = '+'; br = n; int idx, pom; idx = 1; pom = 0; for(int cc = 0; cc < (m - 1) / 2; cc++) for(int i = 1; i <= n; i++) { //cout << "in" << endl; v[i][idx] = '-'; pom++; if(pom == n / 2 + 1) { idx++; pom = 0; br++; } } cout << br << endl; if(lamp == false) { for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) cout << v[i][j]; cout << endl; } } else { //cout << "in" << endl; char pl = '+'; char mi = '-'; for(int i = 1; i <= m; i++) { for(int j = 1; j <= n; j++) if(v[j][i] == '+') cout << '-'; else cout << '+'; cout << endl; } } } void combine() { int t; cin >> t; while(t--) read_solve(); } int main() { /**#ifdef ONLINE_JUDGE freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif*/ ios_base::sync_with_stdio(false); cin.tie(nullptr); ///startT = std::chrono::high_resolution_clock::now(); combine(); return 0; }

Compilation message (stderr)

stones.cpp: In function 'void read_solve()':
stones.cpp:110:14: warning: unused variable 'pl' [-Wunused-variable]
  110 |         char pl = '+';
      |              ^~
stones.cpp:111:14: warning: unused variable 'mi' [-Wunused-variable]
  111 |         char mi = '-';
      |              ^~
#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...