Submission #486277

# Submission time Handle Problem Language Result Execution time Memory
486277 2021-11-11T06:27:06 Z Nimbostratus Crtanje (COCI20_crtanje) C++17
0 / 50
2 ms 588 KB
#include "bits/stdc++.h"
#define endl '\n'
#define fi first
#define se second
constexpr int maxn = 2e5+5;
constexpr int inf = 1e9;
constexpr int mod = 1e9+7;
using namespace std;
using lint = long long;
using pii = pair<int,int>;

int n;
string s;
char g[500][500];

signed main() {
	#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	for(int i = 0; i < 500; i++)
		for(int j = 0; j < 500; j++)
			g[i][j] = '*';
	cin >> n >> s;
	int x = 100, y = 99;
	int mxx = -inf;
	int mnx = inf;
	for(int i = 0; i < n; i++) {
		if(g[x][y] == '/' && s[i] != '\\')
			x--;
		else if(g[x][y] == '\\' && s[i] == '-')
			x++;
		y++;
		mxx = max(mxx, x);
		mnx = min(mnx, x);
		if(s[i] == '+')
			g[x][y] = '/';
		else if(s[i] == '-')
			g[x][y] = '\\';
		else
			g[x][y] = '_';
	}
	for(int i = mnx; i <= mxx; i++, cout << endl)
		for(int j = 100; j <= 100 + n - 1; j++)
			cout << (g[i][j] == '*' ? '.' : g[i][j]);
}

Compilation message

crtanje.cpp: In function 'int main()':
crtanje.cpp:18:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  freopen("in.txt","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
crtanje.cpp:19:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  freopen("out.txt","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 588 KB Output isn't correct
2 Incorrect 2 ms 588 KB Output isn't correct
3 Incorrect 2 ms 588 KB Output isn't correct
4 Incorrect 2 ms 588 KB Output isn't correct
5 Incorrect 2 ms 588 KB Output isn't correct