#include <vector>
#include <iostream>
#include <random>
#include <chrono>
#include <array>
#include <iostream>
#include <functional>
struct Keys
{
double a;
double b;
Keys(const Keys& k) : a(k.a), b(k.b) {}
Keys() {}
};
using Sequence = std::vector<Keys>;
using RemainingSequence = std::array<Sequence, 4>;
struct ExtremalPoints
{
Keys xMin, xMax, yMin, yMax;
};
using ExistingZones = std::array<bool, 4>;
using RelevantZones = std::array<bool, 4>;
using Location = std::array<signed short int, 4>;
using PointSequenceReducedLastTime = std::array<bool, 4>;
struct ExtremalPointsInZones
{
Keys xMinSW, xMinNW, xMaxSE, xMaxNE, yMinSW, yMinSE, yMaxNW, yMaxNE;
};
struct KeysInfo
{
ExtremalPoints extremalPoints;
RelevantZones relevantZones;
ExtremalPointsInZones extremalPointsInZones;
Location location;
PointSequenceReducedLastTime pointSequenceReducedLastTime {true, true, true, true};
RemainingSequence remainingSequence; // º¤ÅÍ·Î ÀÌ·ç¾îÁø 4Çà ¾î·¹ÀÌ ÀÔ´Ï´Ù.
};
void generateRandomSequence(Sequence& Seq, size_t numberOfSeq)
{
Seq.clear();
auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
auto realRand = std::bind(std::uniform_real_distribution<double>(1,(numberOfSeq)), std::mt19937(seed));
for(size_t i = 0 ; i < numberOfSeq ; i++ )
{
Keys key;
key.a = realRand();
key.b = realRand();
Seq.push_back(key);
}
}
int main()
{
Sequence seq;
size_t numberOfSeq = 10000;
generateRandomSequence(seq, numberOfSeq);
KeysInfo info;
std::cout << "size of array " << info.remainingSequence.size() << "\n";
std::cout << "size of first vector" << info.remainingSequence[0].size() << "\n";
std::cout << "size of second vector" << info.remainingSequence[1].size() << "\n";
std::cout << "size of third vector" << info.remainingSequence[2].size() << "\n";
std::cout << "size of fourth vector" << info.remainingSequence[3].size() << "\n";
std::cout << "size of fifth vector" << info.remainingSequence[5].size() << "\n";
// cout ÀÇ °á°ú´Â ´ÙÀ½°ú °°½À´Ï´Ù.
// size of array 4
// size of first vector 8795939219482 // ù¹ø°,
// size of second vector 275 // µÎ¹ø°¿¡¼ ¾²·¹±â °ªÀÌ ³ª¿É´Ï´Ù.
// size of third vector 0
// size of fourth vector 0
// size of fifth vector 0 // ¿©±ä ¿ÀÈ÷·Á 0, ¿©±â¿¡¼ ¾²·¹±â °ªÀÌ ³ª¿Í¾ß Çϴ°Š¾Æ´Ñ°¡¿ä.
Keys k;
remainingSequence[5].push_back(k); // ¿¡·¯¹ß»ý ¾ø½À´Ï´Ù.
}
ÇØ´ç ÄÚµå´Â Å« ÆÄÀÏÀÇ ÀϺΠÀÔ´Ï´Ù.
ÄÄÆÄÀϽà ¸í·É¾î°¡ g++-9 -std=c++17 ¸é ¿¡·¯°¡ »ý±â°í
ÄÄÆÄÀϽà ¸í·É¾î¿¡ ÃÖÀûÈ ¿É¼ÇÀ» ³ÖÀ¸¸é g++-9 -01 -std=c++17 ¿¡·¯°¡ »ç¶óÁý´Ï´Ù.
Á¦°øµÈ Äڵ常 ÄÄÆÄÀÏ ÇÏ¿© º¸¸é ¹®Á¦°¡ ¾øÀ»¼ö ÀÖÀ¸³ª Á¦°¡ ÇÏ°í ÀÖ´Â ÀÛ¾÷¿¡¼´Â ÇØ´ç ¹®Á¦°¡ »ý±â°í Á¦°øµÈ ÄÚµå¿Í ½ÇÁ¦ÀÇ Â÷ÀÌ´Â ¾ø´Ù°í º¾´Ï´Ù. ½ºÆ®·°Ã³¸¦ define ÈÄ ¹Ù·Î »ç¿ëÇϴµ¥µµ ¹®Á¦°¡ »ý±â´Âµ¥ ÀÌÀ¯¸¦ ¸ð¸£°Ú½À´Ï´Ù.