ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1497. Cutting a Square

Hint
Posted by ASK 6 Mar 2010 01:52
It is not necessary a rectangle. Try

5
11111
11011
11011
10010
00000

Yes

and all its rotations.

BTW, to read you can use

#define F(i,n) for(int i = 0; i < n; ++i)
int n;
vector<string> s;
[...]
cin >> n;
s.resize(n, string(n,' '));
F(i,n) cin >> s[i];

and AC at 0.046 second.
input (+)
Posted by ASK 6 Mar 2010 01:57
... whereas

F(i,n) { string str; cin >> str; s.push_back(str); }

results in 0.109 seconds and 500 KB of wasted memory.