Submission #1214992

#TimeUsernameProblemLanguageResultExecution timeMemory
1214992kaltspielerhyCrtanje (COCI20_crtanje)C++20
50 / 50
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int nbJours; cin >> nbJours; cin.ignore(); string liste; getline(cin, liste); vector<string> tableau(300, string(nbJours, '.')); int indexDepart = 150; if (liste[0] == '+') { tableau[indexDepart][0] = '/'; } if (liste[0] == '-') { tableau[indexDepart][0] = '\\'; } if (liste[0] == '=') { tableau[indexDepart][0] = '_'; } for (int iColonne = 1; iColonne < nbJours; iColonne++) { if (liste[iColonne] == '+') { if (tableau[indexDepart][iColonne-1] == '/') indexDepart--; tableau[indexDepart][iColonne] = '/'; } if (liste[iColonne] == '-') { if (tableau[indexDepart][iColonne-1] != '/') indexDepart++; tableau[indexDepart][iColonne] = '\\'; } if (liste[iColonne] == '=') { if (tableau[indexDepart][iColonne-1] == '/') indexDepart--; tableau[indexDepart][iColonne] = '_'; } } for (int iLigne = 0; iLigne < 300; iLigne++) { bool vide = true; for (auto iChar : tableau[iLigne]) { if (iChar != '.') { vide = false; break; } } if (!vide) { cout << tableau[iLigne] << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...