This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <stack> | |
using std::cin; | |
using std::cout; | |
using std::endl; | |
using std::vector; | |
using std::stack; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <cstring> | |
int main() | |
{ | |
using namespace std; | |
while (true) { | |
int n, m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
int main() | |
{ | |
using namespace std; | |
while (true) { | |
int n, m; | |
cin >> n >> m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <memory> | |
int main() | |
{ | |
using namespace std; | |
while (true) { | |
int n, m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __VECTOR_H__ | |
#define __VECTOR_H__ | |
#include <iostream> | |
#include "Trace.h" | |
using std::cout; | |
using std::endl; | |
template<class T> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int t; | |
scanf("%d%*c", &t); | |
while (t--) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <array> | |
struct Ant | |
{ | |
int pos; | |
int order; | |
char direction; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <array> | |
struct Ant | |
{ | |
int pos; | |
int order; | |
char direction; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* correct */ | |
for (int i = 1; i < n; ++i) { | |
if (ants[i].pos == ants[i - 1].pos) { | |
ants[i].direction = 'T'; | |
ants[i - 1].direction = 'T'; | |
} | |
} | |
/* wrong */ | |
for (auto it = ants.begin() + 1; it != ants.begin() + n; ++it) { |
NewerOlder