Saratov State University :: Online Contester


::Go
- home
- news
- register
- update personal info
- problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

::Poll
Are you registered on Codeforces?
Yes
No
What is it???

[results]

::webboard

I think there is something wrong with the mingw compiler
Author: miyanaga_saki
ID: 055727
Problem: 281
Contest: 0
Date: 2013-02-21 08:25:00

It got TLE if I use the mingw compiler, but by using vs2010 I got accepted.

Maybe there is some problem with std::string?

// DONT USE MINGW, OR IT WILL TLE

#include <iostream>
#include <algorithm>
#include <string>
#include <map>

std::string a[50000];
std::string b[50000];
std::map<std::string, int> h;

int main() {
int n;
std::cin >> n;
for (int i = 0; i < n; ++i) std::cin >> a[i];
for (int i = 0; i < n; ++i) {
std::cin >> b[i];
h[b[i]] = i;
}

for (int i = 0; i < n; ++i) {
int tmp = h[a[i]];
if (tmp != i) {
for (int j = i + 1; j < n; ++j) {
if (tmp < h[a[j]]) tmp = h[a[j]];
if (tmp == j) break;
}
std::sort(a + i, a + tmp + 1);
i = tmp;
}
}

for (int i = 0; i < n; ++i) std::cout << a[i] << 'n';

return 0;
}

see sub-tree reply to that message


::Login
Forgot password?

::News
22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553).
22.10.12 - After the start of the contest the statements in PDF will be available by the link.
23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

Server time: 2017-11-24 14:05:50Online Contester Team © 2002 - 2016. All rights reserved.